In the final installment of my Code Craft column, "Staying
Out of Code Debt", I offer some approaches to keeping your
code smelling fresh and clean. More important, it may well help you
get more done in less time.
Code wants to be responsive to change, and when it doesn't get its
way it tries to warn us. But often we aren't listening because it's
too easy to plow ahead to the next feature. Unfortunately, in our
haste we miss a golden opportunity to improve the code, which is
actually the design. And although the consequence of ignoring the code
isn't immediately noticeable, it quickly starts to drive up the cost
of change.
In the latest installment of my Code Craft column, "Relocate
for Reuse", we stop to listen to the code. Heeding its
warnings, we find a new home for small methods that fell out of
earlier refactorings, and end up with code that can be reused.
In the latest installment of my Code Craft column, "Clean and
Green", we use safe and simple refactorings to clean up the
mess we made last month.
Writing pristine code isn't enough. Without tests, you don't have the
confidence to modify the code predictably. Rather, every time you
touch the code a cold chill runs up your spine and your typing fingers
tremble with fear. You've been bitten before—an innocent change
here unknowingly breaks something over there, and what you thought
would take mere minutes has turned into several painstaking hours. And
so the police tape is strung permanently around the code, workarounds
are used to spare the team from going into those crime scenes, and
before long what once was the cleanest code on the planet has decayed
into the nastiest code imaginable.
It doesn't have to be this way. In the latest installment of my Code
Craft column, "Reduce
Stress, Write a Test", we drive out fear and boost
productivity with the help of a test.
Comments. Write too many and it may be a sign that your code smells.
Write too few and the next person is left wondering why something was
done.
In the latest installment of the Code Craft column, Write
Sweet-Smelling Comments, I explain my approach to striking a
balance.