Hacker News new | ask | show | jobs
by neurocline 3373 days ago
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.