How I learned to stop worrying and love clean code

In past bloggings, I’ve mentioned how my coding style has changed over time to reflect a deeper technical knowledge. Recently I’ve also been trying to learn more about software design and engineering from a maintainability and clean practices standpoint. While they are an important tool for accomplishing this, I’m not just talking about design patterns but a knowledge suite of best practices that make for intuitive-to-read and even easier to use code.

Concepts like descriptive function and variable names, small functions, and intuitive design  are stressed heavily, as is design by functional decomposition. All of this I thought I knew, until I got torn apart at my first code review.

Now I’m taking this, applying it to my code, and finding much cleaner and better results. JavaScript I’d written just 8 months ago looks horrendous by comparison to how I write now. Giant C-style functions with a whack of declarations at the top, 100+ lines of functionally independent code, and a general mass of structured but difficult to maintain code. In “modernizing” it and splitting it up into components, I find it reads easier, writes quicker, and even executes faster. I can only chalk this last part up to smaller scope for function JITs and tracing JITs to worry about, but it just goes to show:

Work with the compiler, not against it.

Comments

Leave a Reply

Discover more from Software by Steven

Subscribe now to keep reading and get access to the full archive.

Continue reading