loading...
Cover image for Good code looks like...

Good code looks like...

lifelongthinker profile image Sebastian ・1 min read

... code written by someone who cares.

It's the classic question we all have to answer on a daily basis: What does good code look like?

Join the discussion, add your answer!

Addendum: The idea is not new, I first came across it in one of the many books on clean coding from my bookshelves.

Discussion

markdown guide
 

Self-consistency. That's what I've found to be the common thread in any code that feels "good".

It might be procedural or object oriented or functional or straight up assembly. When it is consistent in style and architecture with itself, it feels "good". It uses as few design patterns as reasonable. When performing similar tasks it does so with similar forms.

It's now something I say It's better to be consistent than correct.

That is, it may be suboptimal or boilerplate or somewhat obtuse; as long as it is consistently that way the software is better than if it is made "correctly" but in 12 different patterns.

 

Great point, Nathan 👍. I absolutely agree: Inconsistencies are a waste of energy.

They clearly scream: I didn't care enough about my code (or those poor people reading it) to make it consistent.

 

Clean code is like a good written book with proper language. It should be precise, informative but most importantly, it should share the message to a wide range of readers.

Readability is what makes code clean.