DEV Community

Discussion on: 10 Clean code examples (Javascript).

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

We all at some point go through a phase where we want to use esoteric language features to write "smart" code, and it's also a phase we all eventually grow out of.

My recommendation is: prefer writing one or two extra lines of code if it helps to show the structure of the algorithm. Big-picture architectural decisions have a much larger impact on readability and how smart your code seems*.

* I don't remember ever seeing a snippet of clever code and being amazed for more than 5 seconds; but there's a few smart design-decisions that I still admire to this day for how much complexity they remove.

Thread Thread
 
padje profile image
Peter dJ

Devs sometimes forget that most extra lines of code have essentially no impact on execution speed... Whereas they can really help legibility.