Live data from Hacker News

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

news.ycombinator.com

1–10 of 30 posts

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

#2
If you don't read other people's code, you are stuck understanding things in terms of the idioms of your own comprehension.

Moreover, reading code is a skill, and much of being a good developer involves working with other people code, which means being able to efficiently parse other people's code.

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

#3

If you don't read other people's code, you are stuck understanding things in terms of the idioms of your own comprehension. Moreover, reading code is a skill, and much of being a good developer involves working with other people code, which means being able to efficiently parse other people's code.

I'm not so sure that's a bad thing? If you understand and work well enough, what's wrong with understanding through your own idioms, etc?

Of course we read a lot of people's code, but I'm not so sure it's something that needs to be actively practiced rather than done naturally over a career (which makes recommending people to read code pointless if it happens naturally).

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

#4
The answer to this question will fall sharply upon two lines depending on how you interpret the definition of "better" developer.

I see one interpretation of better as "can copy, repeat, fix, comprehend, maintain." And the other as "comprehends and exceeds - often without explicitly 'reading' that which is comprehended in the first place"

The first group will argue that you have to read. The second will argue that it's optional.

I am in the second group but would argue in favor of the first. It never hurts to stand upon the shoulders of the giants who came before you.

That being said, I never read other's code unless its to fix it.

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

#5
I wouldn't say reading lots of code is necessary. Reading some code can definitely be beneficial though. If you've just moved to an existing code base, it would be helpful to familiarize yourself with the existing structure, idioms, and patterns. If you're working on something new but don't know how to approach the task, looking at code solving a similar problem or using a similar methodology can help. As with most advice, take it within reason. Don't go to the extreme.

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

#6
I think you are much more likely to get stuck in a local minima if you don't get good at reading code.

-It lets you work effectively as part of a larger team or project

-Gives you a much larger surface area of material to learn from: you can learn new patterns and libraries by seeing how other people use them instead of having to find documentation or tutorials

-Sometimes there are bugs in libraries (open source or otherwise) that you depend on. You will find these much quicker if you are good at reading code.

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

#7
Does reading make you a better writer? Yes.

What does it mean to be a good developer? Do you simply want to write your own black-box undocumented software? Then there is a much lesser advantage to reading other projects' code. On the other hand, if you want to manipulate another codebase, or use another library, reading code is a necessity.

That leaves one final question: Is it beneficial to your own development skill to read others' code? Yes. Proficiently reading others' code is a very beneficial skill, even if you do not intend to write code to be read by someone else. Not only will you get better at reading your own code, you will learn idioms and practices that will improve your comprehension, and writing skill.

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

#8
Yes, just like reading research papers will expand your horizon and build your cognitive map, the more code you read, the more you'll see concepts and patterns repeating. You'll start to identity what's important and how things are related in sometimes subtle ways. You'll encounter the same idea expressed in different forms, in different languages. This will help reveal the essence of an idea as you begin to identify its invariants that persist from language to language and form to form. You'll see contrasts between good code and bad code. Beautiful code and ugly code. Readable vs cryptic code. Clean lines vs nesting. Your sense of style and aesthetics will refine. But don't just read code in your preferred language or domain of expertise. Learn to read code in multiple languages, in multiple paradigms. High level and low level, up and down the stack. Read to refine your thinking. You'll develop fluency, and your code will evolve.

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

#9

If you don't read other people's code, you are stuck understanding things in terms of the idioms of your own comprehension. Moreover, reading code is a skill, and much of being a good developer involves working with other people code, which means being able to efficiently parse other people's code.

I'm not so sure that's a bad thing? If you understand and work well enough, what's wrong with understanding through your own idioms, etc? Of course we read a lot of people's code, but I'm not so sure it's something that needs to be actively practiced rather than done naturally over a career (which makes recommending people to read code pointless if it happens naturally).

Because no man is an island. Your code will never be perfect. There will always be things you miss or do suboptimally -- even for concepts you think you understand.

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

#10

If you don't read other people's code, you are stuck understanding things in terms of the idioms of your own comprehension. Moreover, reading code is a skill, and much of being a good developer involves working with other people code, which means being able to efficiently parse other people's code.

I'm not so sure that's a bad thing? If you understand and work well enough, what's wrong with understanding through your own idioms, etc? Of course we read a lot of people's code, but I'm not so sure it's something that needs to be actively practiced rather than done naturally over a career (which makes recommending people to read code pointless if it happens naturally).

Sure, if you happen to be exposed to a wide variety of code as a result of your work, then probably you'll be fine.

But if all you do at work is line of business apps in VB6 for years on end, then I would recommend reading the source code for some games, database servers, your OS kernel, your favorite text editor, or something unrelated to your job. The point is to expand the scope of the projects that you're capable of undertaking.

Post reply on HN