The Cave

24 Jan

Making Wrong Code Look Wrong

I’ve reached the point I tend to write code a certain way (depending on the language) because, as Joel puts it:

4. You deliberately architect your code in such a way that your nose for uncleanliness makes your code more likely to be correct.

This is the real art: making robust code by literally inventing conventions that make errors stand out on the screen.

One thing Python’s whitespace rules greatly helps – the runtime barfs on things the human (should) barf on too. I find I use fewer non-obvious coding style games in Python than most languages, mostly for this reason. Naming conventions, braces, whitespace, variable declarations, code flow. Stupid little tricks and habits one picks up over the years, using hard won experience to avoid (or at least minimize) repeaing past mistakes.

Of course, these sometimes appear ‘pointless’ to others, even (or especially) if they’re more junior.

And I’ve regularly been taught new Stupid Pet Tricks <g> by my peers, often senior folks, but also more junior developers. Always willing to learn new tricks. And not always just the good ones.

“If you can’t be a good example, you’ll have to serve as a horrible warning.”

FacebookGoogle GmailGoogle BookmarksTechnorati FavoritesTwitterHotmailYahoo MailYahoo MessengerWordPressStumbleUponRedditEmailInstapaperGoogle+Share

Leave a Reply

You must be logged in to post a comment.

© 2015 The Cave | Entries (RSS) and Comments (RSS)

GPS Reviews and news from GPS Gazettewordpress logo