Your code is working? Great, you're not done yet

16 Oct 2014

Writing code is a lot like writing a letter. Your initial version is just a draft, far from its final form.

Sometimes we create chaos in order to get something to work. We place a breakpoint here and there, we name our variables crazy things for the sake of simplicity and/or testing purposes, and once our tests pass we patch things up and commit. This is a recipe for disaster in later stages of our project.

Getting things to work might be challenging, but it's not over when we succeed. We have to be professional about our work and do proper maintenance to our own code before we ship it. Ensure you are covering edge cases, eliminate duplication, extract functionality when your classes are too big, revise your algorithm so your intention is crystal clear.

There are many measures you can take to contribute to the health of your codebase, lifting your own weight is the least you can do.

"Good enough" code might work when we're prototyping something, but if you don't clean up immediately afterwards you never will, and your codebase will snowball into a big mess.

All good code used to be dirty (when it was on draft form), but later on the authors clean it up so it's readable, as simple as it can be, and understandable by others. Complete your work, be professional. Your peers will appreciate it, and so will your future self.