Good code is boring.

There is a quality of great code that most developers never talk about: good code--really great code too--is shockingly boring.

If you want exciting code, write no tests. You'll find all kinds of cool stuff in your application later. And you'll have job security.

Also, name your stuff-your variables, objects, functions, files-using all manner of abbreviated words, word order, capitalization, dashes, underscores. And you know, 'x' is the perfect identifier, everyone knows what that means, right? Just use that, and maybe i, j, and k.

And just let all the devs express themselves. Let all the devs use their own dialect. Diversity is a value, right? Some writers write novels, some narrate short stories, some theorize in essays, some compose poems. So some devs write really long modules. Some devs are concise. Some devs enjoy being clever. Let them all be who they are. It will make supporting your project really heart-pumping, fast-paced for some Saturday morning release.

To keep it real exciting, never pick controlling patterns. For the fun and adventure of it, allow future engineers to discover just which pattern was used for that particular service or set of modules. If they don't know whether the module exports an object or a function or a class, they'll have fun. It will be a learning experience! That's what we want our devs to have, right?

And endlessly debate emerging technologies, packages, and approaches. We must be learners and stay up on the edge or we will be left behind. Try a new package when you feel like it. Throw it in the project, give it a whirl! Refactor a few modules to use it. It will make the project a nice, diverse mix of packages. Something for everybody.

For the most fun, leave jewels buried somewhere in the rough. You know, like, `project/server/src/routes/stuffGet/helpers/utils/project_config.json`. Bury those key files and scatter them out. Half the fun is the expectation, right?

Or not.

I'm starting to believe that the best gift I can give to other engineers, or my future self, is really boring, predictable code.

It seems we all obsess about which language, framework, library, syntax, pattern, standard, and approach to use or apply.

All that matters, for sure, but I would much rather have to pick up code and work on a legacy app where the older stuff is organized and written well, rather than pick up code on your bleeding edge app that is under-engineered (or over), too clever by half, and a labyrinthine nest of developer trials-by-fire.

So, right now, how exciting or boring is your code?

Can I open up your project and see where everything is located quickly?

Can I peak inside a folder and see consistently named files?

Can I peak inside a folder and see all the contents in a list that completely fits on the screen?

Can I open 3 or 4 modules and see a nice, ordered sequence of code that fits inside just a couple of scrolls (or less) down?
Is the sequence of stuff consistent?
Do the modules return the same kind of thing?
Is there a file right next to that module called 'myModule.test.js'? Or something similar. Or maybe in a folder `tests`?

Can I read through one of those modules and know what the "things" are?
Are the variable identifiers clear?
Are the function names verbal and descriptive?

Can I open your main README and quickly learn everything I need to know what this thing is, where the key files are, how to start and run the thing, how to run the tests, and where to look for more detailed documentation?

I used to live a very exciting life as a coder. But now I say, "no thank you," to exciting code. Adventures are fun, but let's keep them in the movies. I want to do my coding and leave on Friday at 5 with the confidence that on Saturday morning I won't have to debug a recent release with adrenaline pumping and heart racing like Indiana Jones outrunning a giant rock.
 

Chadamoore.com · Copyright © · Caveat Lector