Nowadays, coding isn’t just about writing code. We also write test code, we want to write clean code, we want others to like the code – at least not to hate the code, we want to embrace change, we want to deliver value and keep on doing so. Code is providing value and code is also value.
“We must write unit tests.”
Easy! Yep easy to say and easy to understand that, but hard, very hard to get it done. It requires discipline and rigor.
We see messy things, so many crappy codes. And we may get used to that, or wishing not to be there to sort out the mess. We all want to avoid and escape it. We move to another project, or we quit the job in order to get away. The thing is, ugly codebase is everywhere. If we were so lucky to may land on a clean codebase, it’s like winning the lottery. Most of the time, it’s not. Now, let’s just start dealing with those weird things that others have created.
Ten years ago, I was asked in an interview : “How do you deal with existing code, knowing that it works just fine?” I said : “If it’s working, I won’t touch it at all. I don’t want to break anything”
The thing is, if it is well tested – with a lot of unit tests, component tests, integration tests, end-to-end tests, load tests, sanity tests – we won’t be afraid of breaking anything.