It happens all the time. I’m sitting at my computer hacking away at a feature or two and I run into a coding dilemma. I have two ways of solving it:
1. The easy but sort-of-hackish way
2. The difficult but correct way
Sometimes it’s very tempting to choose Option 1. “C’mon” you tell yourself.” It’s a tiny hack that’ll make the code just a tiny bit less-readable and less-scalable. I’ll clean it up later.” Choosing Option 1 allows you to make the quick fix and move on to cooler, more exciting features. But, it pollutes your code and doing it often can make your code unmanageable.
Choosing Option 2 however will take hours of work because of the major refactor it requires but it won’t pollute your code. It’s a chore and chores suck. Refactoring code is like cleaning up your house. It needs to be done but it’s tedious and boring. The feeling afterwards however is very rewarding but it’s hard to build up the motivation to get started.
Sometimes you stare off into space for an hour trying to think of an Option 3. Other times you take a break and play Counter-Strike for 20 minutes. Maybe you decide to go outside and take a run.
I find the easiest way to get around this road block is to just force myself to begin Step 1 of Option 2. It’s hard to overcome the static friction to get the wheel in motion but once you’re rolling, kinetic friction is much easier to manage.
How do you deal with this coding dilemma? Do you always choose Option 2? If so, is it hard to get yourself rolling?