97 Things Every Programmer Should Know

(Chris Devlin) #1

(^48) 97 Things Every Programmer Should Know

Don’t Be Afraid

to Break Things

Mike Lewis

EVERYONE WiTH iNDUSTRY ExPERiENCE has undoubtedly worked on a
project where the codebase was precarious at best. The system is poorly factored,
and changing one thing always manages to break another unrelated feature.
Whenever a module is added, the coder’s goal is to change as little as possible,
and hold his breath during every release. This is the software equivalent of
playing Jenga with I-beams in a skyscraper, and is bound for disaster.

The reason that making changes is so nerve-racking is because the system is
sick. It needs a doctor, otherwise its condition will only worsen. You already
know what is wrong with your system, but you are afraid of breaking the eggs
to make your omelet. A skilled surgeon knows that cuts have to be made in
order to operate, but she also knows that the cuts are temporary and will heal.
The end result of the operation is worth the initial pain, and the patient should
heal to a better state than he was in before the surgery.

Don’t be afraid of your code. Who cares if something gets temporarily broken
while you move things around? A paralyzing fear of change is what got your
project into this state to begin with. Investing the time to refactor will pay for
itself several times over the lifecycle of your project. An added benefit is that
your team’s experience dealing with the sick system makes you all experts
in knowing how it should work. Apply this knowledge rather than resent it.
Working on a system you hate is not how anybody should have to spend his time.

Free download pdf