Live data from Hacker News

Ask HN: Where do I find good code to read?

news.ycombinator.com

201–210 of 216 posts

Re: Ask HN: Where do I find good code to read?

#201
post #193

Earlier quoted context omitted.

My craft is not leaving a dumpster of a solution to the next people to look at my code when business logic inevitably changes. If someone's solution to seeing my code is "we gotta re-write it", I have either failed or a much more novel solution was discovered that makes my code irrelevant. I hope it's not the former.

Your “craft” is not to write code, it’s to solve problems. If you can’t be proud of the problem you’ve solved, you are no engineer. That’s the main difference between an engineer and a scientist.

I am guessing that your definition of "problem" is a bit too narrow and simplistic.

> Your “craft” is not to write code, it’s to solve problems.

Writing code is part of solving problems.

The quality of code has an impact on the various aspects of how a group of people solve problems.

As a small example - consider onboarding time for a codebase/system. Longer onboarding time means - lower profits end of the day for the organization (I'd also argue that longer onboarding times correlates higher talent attrition). And code quality has a strong influence on onboarding time.

Code quality has an impact on the "debuggability" of your systems. How quickly can you fix stuff when things go wrong?

Code quality has an impact on the "deployability" of your systems. If your code is well-done it is easy to deploy, redeploy, etc.

I can cite maybe 10 more properties crucial to org health, which are influenced at least partly by code quality.

So, "the problem" is not as simple as it may seem at first glance.

Re: Ask HN: Where do I find good code to read?

#202
post #193

Earlier quoted context omitted.

Your “craft” is not to write code, it’s to solve problems. If you can’t be proud of the problem you’ve solved, you are no engineer. That’s the main difference between an engineer and a scientist.

I am guessing that your definition of "problem" is a bit too narrow and simplistic. > Your “craft” is not to write code, it’s to solve problems. Writing code is part of solving problems. The quality of code has an impact on the various aspects of how a group of people solve problems. As a small example - consider onboarding time for a codebase/system. Longer onboarding time means - lower profits end of the day for th…

Or maybe “code quality” really means how visually pleasing the code is, or maybe it means it takes up the least amount of disk space, or what if it means code that doesn’t use the letter ‘e’?

This is why the pursuit of “high quality code” is pointless; you are not an artist, you are aligned to solve a problem. If you do that, code or not, you are doing good work as an engineer. If you are not, you are not. Whether the code fits some arbitrary definition of “good” separate from your ability to solve a problem doesn’t play into it.

Re: Ask HN: Where do I find good code to read?

#203
post #202

Earlier quoted context omitted.

I am guessing that your definition of "problem" is a bit too narrow and simplistic. > Your “craft” is not to write code, it’s to solve problems. Writing code is part of solving problems. The quality of code has an impact on the various aspects of how a group of people solve problems. As a small example - consider onboarding time for a codebase/system. Longer onboarding time means - lower profits end of the day for th…

Or maybe “code quality” really means how visually pleasing the code is, or maybe it means it takes up the least amount of disk space, or what if it means code that doesn’t use the letter ‘e’? This is why the pursuit of “high quality code” is pointless; you are not an artist, you are aligned to solve a problem. If you do that, code or not, you are doing good work as an engineer. If you are not, you are not. Whether th…

You refuse to define the problem in a comprehensive way in the first place. That's the meta-problem :)

The second issue is that you think it is impossible to define an "abstract good" in code quality given a specific context (team, product, market). The "abstract good" stems on its own for the given internal culture and market situation. Through some common sense examples, it is easy to see how "abstract good" wields influence on "practical parameters" critical to business survival/thriving.

As an analogy, I can say the "body is healthy". I am aggregating a bunch of metrics to say - "this is healthy". It doesn't mean the term "healthy" is meaningless. The term "healthy" has useful meaning although not at a mathematically precise level. One could even argue that the term "healthy" captures something even precise mathematics cannot capture (it's abstracted at a higher level). Apply similar argument to the term "code quality".

Edit: Maybe it is better to explore the idea of code quality "via-negativa". Find what's actively harming beneficial outcomes. And remove it. If you cannot find many harmful things, then it has high code quality.

Re: Ask HN: Where do I find good code to read?

#204
post #202

Earlier quoted context omitted.

Or maybe “code quality” really means how visually pleasing the code is, or maybe it means it takes up the least amount of disk space, or what if it means code that doesn’t use the letter ‘e’? This is why the pursuit of “high quality code” is pointless; you are not an artist, you are aligned to solve a problem. If you do that, code or not, you are doing good work as an engineer. If you are not, you are not. Whether th…

You refuse to define the problem in a comprehensive way in the first place. That's the meta-problem :) The second issue is that you think it is impossible to define an "abstract good" in code quality given a specific context (team, product, market). The "abstract good" stems on its own for the given internal culture and market situation. Through some common sense examples, it is easy to see how "abstract good" wields…

You’re falling for the trap I’m suggesting you avoid. Stop caring about platonic ideals of what Good Code ought to be, and start focusing on how well the code solves the problems it was built to solve.

You can call that good code if you want, but my argument is to stop caring about the code’s “quality”, as a value it carries independent of the problem.

Re: Ask HN: Where do I find good code to read?

#205
post #204

Earlier quoted context omitted.

You refuse to define the problem in a comprehensive way in the first place. That's the meta-problem :) The second issue is that you think it is impossible to define an "abstract good" in code quality given a specific context (team, product, market). The "abstract good" stems on its own for the given internal culture and market situation. Through some common sense examples, it is easy to see how "abstract good" wields…

You’re falling for the trap I’m suggesting you avoid. Stop caring about platonic ideals of what Good Code ought to be, and start focusing on how well the code solves the problems it was built to solve. You can call that good code if you want, but my argument is to stop caring about the code’s “quality”, as a value it carries independent of the problem.

It's not platonic, my argument is empiric.

The physician - operates "via negativa". He tries to find faults with the given body, tries his best, and when can't find - he calls it "healthy".

The engineer/businessman can look at the code from an empirical point of view.

If onboarding is bad -> code is bad

If understandability is bad -> code is bad

If deployment is bad -> code is bad

And so on. As you eliminate these issues, your "code quality" increases (just like as you eliminate disease, the body becomes more healthy).

Look into say, Taiichi Ohno's Toyota Production Management - one associates "zero defect" ~= "quality". So, the term quality alludes to a continuous elimination of faults and shortcomings.

The aggregate placeholder/banner term 'code quality' stems from very firm practical sources, that can be inspected, amended and improved.

Re: Ask HN: Where do I find good code to read?

#206

Earlier quoted context omitted.

Mastery, perhaps. They see some sort of role model and figure the tools they use are a roadmap to becoming a distinguished engineer themselves. If only it was that easy. It is interesting how functional programming has to consider data organization completely differently, but sometimes it is just that, a tool or methodology, not a philosophy to subscribe to. Ideally, the good (or future good) engineers realize this a…

I guess that's probably a lot of why I don't get it, I never had any programmer role models. I looked up to Adam and Jamie, and I never saw them doing serious code.

Who are Adam and Jamie? Mythbusters?

Re: Ask HN: Where do I find good code to read?

#207
post #206

Earlier quoted context omitted.

I guess that's probably a lot of why I don't get it, I never had any programmer role models. I looked up to Adam and Jamie, and I never saw them doing serious code.

Who are Adam and Jamie? Mythbusters?

Yep! For a while when I was really little I thought maybe I wanted to make video games, but... that's really hard.

The stuff I was really excited about was mostly "tech in the physical world" related.

Although with the AI boom, and how I'm too clumsy for jobs involving driving... I might be making a lot more if I'd at least tried to focus on the pure programming stuff instead of embedded, even though I never had any real talent for advanced algorithms...

Re: Ask HN: Where do I find good code to read?

#208
post #204

Earlier quoted context omitted.

You’re falling for the trap I’m suggesting you avoid. Stop caring about platonic ideals of what Good Code ought to be, and start focusing on how well the code solves the problems it was built to solve. You can call that good code if you want, but my argument is to stop caring about the code’s “quality”, as a value it carries independent of the problem.

It's not platonic, my argument is empiric. The physician - operates "via negativa". He tries to find faults with the given body, tries his best, and when can't find - he calls it "healthy". The engineer/businessman can look at the code from an empirical point of view. If onboarding is bad -> code is bad If understandability is bad -> code is bad If deployment is bad -> code is bad And so on. As you eliminate these is…

Sure, but you are in agreement with what I’m saying; good code implies specificity towards the line-by-line writing and structuring of the language (that’s what “code” is, more or less), and I argue that’s useless, as do you here by citing examples of how the code solves the larger problem in the system.

Re: Ask HN: Where do I find good code to read?

#209
post #17

Give up on “good code”. Its pursuit is how junior devs pesters senior devs based on a delusion that such a thing is possible. Good code is working code, code that pays the bills. Focus instead on writing code you can throw away easily, code that you are wholly unattached to and is isolated enough that rewriting it won’t cost absurd hours.

Sounds like you've been surrounded with bad code all your life. This isn't true.

Re: Ask HN: Where do I find good code to read?

#210

Earlier quoted context omitted.

agreed. really any performance oriented code would be useful. god help the kids reading the trash that makes up 99% of the code out there today.

Performance oriented code can be hard to maintain. Writing things in unintuitive ways to try to coerce the compiler into doing fewer instructions can result in code that's harder to read.

There are degrees. I’d be happy to not see code generating millions of medium lifetime garbage objects per request.
Post reply on HN