Fear of code
Have you ever opened up a code base, looked at it, and known that it was a complete train wreck? Not only was it undocumented, it didn't have unit tests either? Your goal is to make a change. But every where you look you find nice little corners of craziness that if changed, will have unforeseen consequences.
The worst part of the code base, is that you wrote it last week. Or two months ago.
Sure, you have learned new things since then, but this isn't the code you wrote when you were just starting out, or three years ago. This is the code you wrote last month. And now you want to go back and kill two-month-ago-you for not following best practices by documenting the code and writing unit tests.
The best way to fix this problem is to start writing unit tests now. Know that two-month-from-now-you will want to throttle now-you if those tests aren't written. It doesn't matter that the code is trivial. You don't need 100% coverage. You know the parts that are messy. You know the parts that are easily broken. Write tests for those at least.
For the love of two-month-from-now-you... write the tests!
No comments:
Post a Comment