Want clean code? Stop using the editor.

Want clean code? Stop using the editor.

Eric Smith

December 21, 2007

Recently I was adding some accessors to a ruby class on the fly, and I kept getting confused by a certain code block.

The code isn’t particularly complicated, just creating a quick accessor to get at the underlying hash.

eval <<-eof def>

Yet I had a couple bugs simply because without the editor to give me hints, the code was that much harder to follow.

This turns out to be a blessing in disguise, as I am forced to write extremely clean code just to keep from confusing myself. Opening up the String class cleans this up a bit, and removes duplication.

So the next time you think your code isn’t as clear as it could be, or maybe if you think it’s perfect, try reading it without any syntax highlighting. If you can still follow it quickly and easily, then maybe it doesn’t entirely suck.

Eric Smith

Principal Crafter

Eric Smith is a fan of the Chicago Bears, Chicago Cubs, and Bruce Springsteen; and he’s the recent author of Game Development with Rust and WebAssembly, published by Packt. Eric is a consummate polyglot, with more than a decade of experience leading development teams and delivering software for global enterprise systems. He has also delivered native Android and iOS apps at every stage of their lifecycle.