Live data from Hacker News

Ask HN: Does reading code actually make you a better developer?

news.ycombinator.com

11–20 of 30 posts

Re: Ask HN: Does reading code actually make you a better developer?

#11
Short answer, yes. Long answer: Learning how to read other people's code will help your literacy of the language and you may even learn a new trick along the way. It might seem like an arduous task now, but as you get into the habit of reading more code, you'll be able to recognize patterns and processes much faster thereby improving your velocity.

Re: Ask HN: Does reading code actually make you a better developer?

#12
Certainly yes! The chief reason is that you'll learn the difference between code you like and code you don't like. You'll learn what makes up that difference, so you can build it into your own code in the future. You will develop taste, so to speak. Taste is important.

Re: Ask HN: Does reading code actually make you a better developer?

#14
The very short answer is - writing code makes you a better developer. But it's incredibly rare for you to be able to invent every pattern, every useful trick, every readable style, so you read others' code. Your ability to understand what you see in others' code (and to judge it) goes up as you get better. So you write lots of code, read lots of code, write lots of code...

There is an analogy to writing in a human language. If all you do is read for 10 years, and then start writing, you'll almost certainly be a bad writer. You learned to read and extract information (and get enjoyment), but you almost certainly didn't understand how writers achieved those goals. This is even more sure for programming. Writing code over and over again helps teach you when and why to apply certain rules, because code has to work, not just look pretty.

But unlike writing human languages, there is far more to learn about computer programming - it's not just grammar and style, there's all levels of design, and architecture. So you read articles and books, but those are usually very hand-wavy. By reading the code for very large programs and then trying to copy what you see, you learn.

Also unlike writing human languages, you start by writing code. Reading code before you've written any is nearly pointless - you just won't understand what you are looking at.

It also matters what code you are looking at, just like it matters what you are reading - but again, only once you get good. So until you think you are at the median level for software engineering, don't worry too much about what you read.

The cool thing is that there's so much code available to read now, as compared to 40 years ago when programming first started becoming a real thing. And especially with Google and a few others not just employing hordes of great engineers but releasing a lot of their source as open-source. Read the Chrome source, for example. Or the Linux source.

Re: Ask HN: Does reading code actually make you a better developer?

#15
Having worked and still working for years fixing other people's code... it definitely teaches you how to code and how not to code. I've seen things that made me question the competency of the programmer, but I've also seen many codes doing the same thing, but written in different ways. There are also those times where you think: "Wow, this code is so poetic!"

So reading other code can surely help. I have seen some Github projects where I would have loved to have used the project for personal use, but I just couldn't understand the coding style, or have had to incorporate my own coding style because I could not adopt the code as it was in the program.

Re: Ask HN: Does reading code actually make you a better developer?

#16
It's far too simplistic to say, yes or no.

If you are inclined towards self-motivated improvement and if you have a good internal monologue where you are able to be real honest with yourself and your own failings and limitations then reading good code opens up the possibility that you can apply the things you take away from it to your own code and become better.

Good code isn't a gold ticket, it's always on you.

Re: Ask HN: Does reading code actually make you a better developer?

#17
Reading code without judging is a superpower, because it breaks your mental blocks and makes you versatile. You can work on others code comfortably, fix things, and learn the good parts quickly without getting frustrated. My biggest issue was that - I was expecting everyone to think like me :)
Post reply on HN