Write all your code “clean,” the first time you write it. Make classes for everything. Use enumerated types. Don’t take shortcuts. Don’t have any part of the code where you say, “Oh, yah, I just glossed over that for now.” You are NOT going to go back and fix it. Seriously, how often do you say to yourself, “I think I’ll dive into this messy code today and try to make it nice and pretty without adding any functionality?” Nobody is going to pay you for that. In fact, I got called on the carpet for cleaning code during a major update to a piece of software at a previous job — “What are you doing spending time modifying code that already works? Just add your new features and be done.” Never mind that I couldn’t understand the code, or that clean code is stable, maintainable, extensible code.
Thank you for reading my work.
Did you enjoy this post? You can find more like it in the sidebar. Please browse the archives,
there are lots of hidden gems. A Brief
History of Dangerous Ideas explains what I am up to at the moment.
Comments on “Gold-plating code is unsound, but armour-plating it is a good idea”:
"Make classes for everything."
Ah, but that reminds me of a certain count the number of golf balls in the lake feature that could be as simple as golfBallsInLake++
Seriously, how often do you say to yourself, “I think I’ll dive into this messy code today and try to make it nice and pretty without adding any functionality?”
Actually, I do this all the time. Maybe I'm just weird, but I thought most people continually refactored their code to improve it?
Seems like having a good boss and a relaxed work environment would solve this problem. I'm lucky to have both and I always spend 10-15 minutes each day just running through and refactoring code that's getting out of hand.