Live data from Hacker News

Nobody's just reading your code

akkartik.name

1–10 of 188 posts

Re: Nobody's just reading your code

#2
One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/? Dig under the covers and understand what's happening. Include that information in a bug report, and better yet, open a PR offering to fix it.

You'll learn a whole lot and be more effective if you let your curiosity expand beyond code you/your team has written.

Re: Nobody's just reading your code

#3
post #2

One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/ ? Dig under the covers and understand what's happening. Include that info…

No mention of time in the article or in your comment.

With infinite time we could fix a lot of things.

Re: Nobody's just reading your code

#4
post #2

One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/ ? Dig under the covers and understand what's happening. Include that info…

That's one thing that bothers me about modern Electron-style apps which depend on an entire web rendering engine -- actually digging through all the dependencies to track down a bug can be almost impossible. For example, I was hitting a bug in an Electron app a while back and wanted to track it down. I got the app building with a locally-built version of Electron, but it became clear the real bug involved Chromium's loader code. My poor 4-year-old laptop ran out of disk space before I could even download the whole libchromiumcontent repository, let alone build it!

Re: Nobody's just reading your code

#5
"But you can’t expect a map to tell you what questions to ask, and it makes no sense to read a map linearly from top to bottom, left to right."

But you can read/view a map as an illustration to get an overall view of the layout of things and how they are connected.

I read code. It surprises me that people deem themselves an expert in some 3rd party lib without actually understanding the internals.

Re: Nobody's just reading your code

#6
post #2

One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/ ? Dig under the covers and understand what's happening. Include that info…

> ... willingness to fearlessly dig into someone else's code.

I've done this many times. The problem is that it takes a lot of time, and there's no way you can dig through more than a fraction of a large codebase. You gotta pick your battles.

Re: Nobody's just reading your code

#7

"But you can’t expect a map to tell you what questions to ask, and it makes no sense to read a map linearly from top to bottom, left to right." But you can read/view a map as an illustration to get an overall view of the layout of things and how they are connected. I read code. It surprises me that people deem themselves an expert in some 3rd party lib without actually understanding the internals.

[deleted]

Re: Nobody's just reading your code

#8
post #3
post #2

One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/ ? Dig under the covers and understand what's happening. Include that info…

No mention of time in the article or in your comment. With infinite time we could fix a lot of things.

Sure, but I think many programmers underestimate the investment value of that time.

Diving into codebases is a skill that gets stronger with use, such that you can eventually do it radically faster. That makes a much larger set of problems economically practical to fix.

Re: Nobody's just reading your code

#9
post #2

One of the things that sets a good programmer apart is the willingness to fearlessly dig into someone else's code. I've heard it said before that you're responsible for every line of code you ship to your users. It follows that you shouldn't treat your dependencies as black boxes. Getting a stack trace that's 3 or 4 levels deep in Django/React/ ? Dig under the covers and understand what's happening. Include that info…

I always get an uneasy feeling when this is not (practically) possible. Whenever I add a dependency to a project I will at least skim through the source to get an idea of what it is I’m adding, and it pleases me a lot when a library is well written and self contained enough that this does not mostly leave me confused or overwhelmed.

There’s a similar reason why I have such mixed feelings about some build tools and compilers, especially in the JS world - the output is often hideous and so unlike what a human might write. I know you can say that what the output looks like doesn’t really matter, as long as it works as it should. But it just makes it so much harder to feel confident that it actually does.

Re: Nobody's just reading your code

#10
I’d like to spend more time reading great code. I think I’d get something out of it.

Possibly more important, though, I’ve always had a fearlessness to dive into a codebase. I’ve built a little thing called Cronitor and recently I was giving a talk on building our first server agent in Go. Long story short, there were a few people surprised that I studied a couple crond implementations to figure out some important details for proper monitoring and I was surprised they were surprised. I don’t write much c or any c++ but as long as you approach it with some fearlessness and a simple plan you can learn from unfamiliar codebases. Spend up to an hour figuring out how a project is structure (hopefully a lot less) and then just skim/grep to find a spot probably close to what you’re looking for. Spread out from there.

The best way to learn a new language is to build something useful and learn what you need along the way. I think studying code can be done the same way.

Post reply on HN