Live data from Hacker News

Good code is like a love letter to the next developer who will maintain it

addyosmani.com

71–80 of 274 posts

Re: Good code is like a love letter to the next developer who will maintain it

#71

As someone who has gone back and read my old code as well as a lot of others old code, there is no such thing as good code. IMHO, the problem is one of cultural context which is often not shared between generations of coders. Languages and best practices can change so violently that best-practices one decade are often anti-patterns in the next. As a codebase outlives its best-practices, do you stick with them and ext…

> there is no such thing as good code.

nor is there such a thing as a good love letter

Re: Good code is like a love letter to the next developer who will maintain it

#72

Earlier quoted context omitted.

My personal experience is that the majority of developers I ever encounter at work (as opposed to within my social network) are usually slow because they're bad engineers who don't understand problems quickly, don't have the knowledge or experience to see solutions quickly, and in general don't think deeply quickly. It's not hard to 3x performance without sacrifices when the baseline is mediocre at best. "Fast must b…

> the majority of developers I ever encounter at work are usually slow because they're bad engineers hm, something about this that I just can't put my thumb on

It's a bit elitist[1]. They're saying we should expect 3x better performance from engineers. We should also expect them to write good code at this pace. The only reason we don't have these things is that most engineers are simply bad engineers. Only people the author perceives as good enough should ever be used as a metric of normal productivity. Presumably the author puts themselves in this group of good engineers.

   1. https://en.wikipedia.org/wiki/Elitism

Re: Good code is like a love letter to the next developer who will maintain it

#73
post #62
post #12

Sorry next developer, I'm on a tight deadline, used to love this craft, now I just do what the product people tell me to get a nice paycheck.

The craft is not the code, but the product. You can have beautiful code and garbage product, and great code and a garbage product. If your PM is pushing bad products, that's on them. Your job is to deliver good product, not good code.

Can’t it be both?

Re: Good code is like a love letter to the next developer who will maintain it

#74
post #70

As someone who has gone back and read my old code as well as a lot of others old code, there is no such thing as good code. IMHO, the problem is one of cultural context which is often not shared between generations of coders. Languages and best practices can change so violently that best-practices one decade are often anti-patterns in the next. As a codebase outlives its best-practices, do you stick with them and ext…

> there is no such thing as good code definitely not true. this is good code: https://github.com/torvalds/linux/blob/master/fs/file.c this is good code: https://github.com/golang/go/blob/master/src/strconv/atoc.go its formatted, commented, direct. the fact that you struggle with writing time tested code does not mean that everyone does.

I wrote some code that was years ahead of a distinguished engineer's existing code. He immediately saw where I was going and adjusted his code accordingly (by dropping my branch and authoring a new branch. I assume because he didn't understand git, but I believe he was protecting his future performance review). Some people won't admit someone else can write better than them.

Re: Good code is like a love letter to the next developer who will maintain it

#75

As someone who has gone back and read my old code as well as a lot of others old code, there is no such thing as good code. IMHO, the problem is one of cultural context which is often not shared between generations of coders. Languages and best practices can change so violently that best-practices one decade are often anti-patterns in the next. As a codebase outlives its best-practices, do you stick with them and ext…

maybe there's no good code but there's degrees of terribleness. It can make all the difference in the ability to safely add to it in a timely manner or not.

Re: Good code is like a love letter to the next developer who will maintain it

#76
post #18

fuck the guy after me. I write good code for my own sanity and so my OCD doesn't make me want to refactor it all later. it's like saying save the trees for your grandchildren or the future generations. fuck them, I want a clean environment for myself gosh darn it!!

Had me in the first half

Re: Good code is like a love letter to the next developer who will maintain it

#79

Earlier quoted context omitted.

Metaphors are also ways of communicating ideas. A good metaphor is as simple or as complicated as it needs to be in illustrating a new concept

Problems arise as soon as you (ab)use a metaphor (used to explain a higher level/adjacent problem) to explain concepts it was never meant to model. Example: Array of items as a shopping cart: how do you efficiently remove an item from the array (as you can from a shopping cart)?

[deleted]

Re: Good code is like a love letter to the next developer who will maintain it

#80
post #40

Earlier quoted context omitted.

When I do personal projects for myself, I try to comment them really well for this exact reason. Just today in fact I was trying to update some code I wrote two years ago because one of the underlying tools broke. I was very happy with past me for commenting the workflow of that tool so I could easily work around it.

A good alternative is code without comments that communicates just as well as that code without the comments. Not necessarily better but less likely to slip out of sync with the comments upon change.

I'm a big fan of self documenting code, but especially when I'm doing quick and dirty projects for myself, where I value speed and cleverness over correctness, the comments really help. Especially when it comes to explaining past me's cleverness.
Post reply on HN