Live data from Hacker News

Good code is rarely read

alexmolas.com

11–20 of 115 posts

Re: Good code is rarely read

#11
post #2

I don't think the author has worked on long-lived projects. Eventually, all code is revisited because there's always shit to get done.

I don’t think you read the whole article. I had the same thought as you from the headline, but they gone on to state that good code is so easy to read when you need to make changes that you don’t have to go through it multiple times to make the required changes.

Re: Good code is rarely read

#12
post #3

I don’t think this is a good rule of thumb. Code that does what it should is rarely read. Until you need to change it. And it may not be changing due to it being incorrect. If an attendant system gets replaced, you may have to change all the other systems it has touched. Business requirements may have changed. Stakeholders may have changed. There are plenty of reasons for code to change beyond there being a bug.

I don’t think you read the whole article. I had the same thought as you from the headline, but they gone on to state that good code is so easy to read when you need to make changes that you don’t have to go through it multiple times to make the required changes.

Re: Good code is rarely read

#13
That doesn't make sense . A good quality code is ready a lot, internally we reference good code as example for new employees and it is also being read, reused again and again. The author looks like just non-engineer manager.

The bad code is read a few times and refactor as soon as we get a chance.

Re: Good code is rarely read

#14
At a minimum, new code should be ready more than it is written. It's written once, then reviewed by the author and by one or more peers on your team.

Not doing code review on a collaborative project? You're already setup for failure...

OP's point of view is valid if they are the only one working on the project. Only you are responsible for your low standards.

Re: Good code is rarely read

#16
This feels borderline tautological: good code is good because it’s good.

Good or bad, you’re going to end up needing to add new features to this code. Or someone misunderstood an input or output to/from this code and you’ll need to read through it to understand how it’s implicated in a bug.

I think ‘good code is easy to read’ is pretty profound: DRY code with the right abstraction is easy to read. DRY code with the wrong abstraction is hard to read.

Re: Good code is rarely read

#17
In the real world, code is read often and for many reasons. The main ones I can think of are:

    1) To understand the system without necessarily wanting to change anything. This is common with new employees or anyone wanting to learn more.
    2) The system often needs tweaks, bug fixes or new features. Each of these normally requires that the code in question is read by several people several times.
    3) The architecture is normally not perfectly modular, so changing one part often requires one to understand and tweak the neighbouring parts of the system, too.

Re: Good code is rarely read

#18
> In conclusion, good code is rarely read.

i offer the entirety of sqlite as a counter-example. Based on that project's forum traffic and my participation within that project, i estimate that there are hundreds, if not thousands, of people who actively read that project's C code. That doesn't make it "bad code," that just makes it code which people want to understand (which, in turn, requires reading).

Re: Good code is rarely read

#19
So code that gets read a lot isn't good code, got it.

This means that core algorithm bundles in business applications that necessarily carry a lot of complexity and need lots of careful maintenance over the decades can never reach the status of good code.

On the other hand, the twenty lines of bash I use to hook mpv into SomaFM streams are very good code.

Re: Good code is rarely read

#20
There is an entire discipline on the idea that the effort to make code easily read/understood will result in source code which is easier to maintain and write:

https://literateprogramming.com/

(or if that's off-line, see: https://en.wikipedia.org/wiki/Literate_programming )

and published books which exist so that folks can read the source code of programs:

https://www.goodreads.com/review/list/21394355-william-adams...

Post reply on HN