TDD vs Procrastination
Webcu • May 11, 2020tdd
One of the main benefits that I see about testing, in general, is that a well-tested code base, give confidence to the developers making changes to the software. However, TDD like any other technique or methodology is not a silver bullet. It is not always possible to implement TDD or desirable. Like almost everything in Software Development and life, it is a trade-off and it depends on each situation. Only experimenting, compiling the data, and analyzing it, could we determine what works better for us. I found really interesting these links about TDD and testing: - TDD is dead. Long live testing - Why Most Unit Testing is Waste - Is TDD Dead?
Procrastination is a very common problem and even more in these times of pandemic. With a high rate of unemployment, it’s more important than ever to get a good preparation for the interviews. One important part of the interview preparation like Software Engineer is to refresh/update our abilities to solve interview questions related to algorithms and data structures. If you don't use trees, graphs, and similar, too often, it could be kind of difficult to get in the mood to tackle these problems.
Sometimes I look for an exercise, I check the description, it seems not so difficult to me, but there are too many edge cases to handle, then I let it for tomorrow, tomorrow becomes next week, next week becomes next month and so on. Recently I was going down this rabbit hole but I decided to change my approach and I used TDD to solve it. I started writing a test. I didn't solve the exercise at that moment, but I gained momentum and I was able to complete it the same day, not next week or next month. What about if you don't feel like writing test? Just start with one, the most simple that you can. After I found the 2-Minutes Rule by James Clear, I’m trying to apply it every time I feel I’m procrastinating. We need to make the habit as easy as possible to stick with it. If our goal, is to write tests, we should start just with one. Next time the same thing, until the habit will stick with us.
OK, fine, but what about if you don't feel even in the mood to write a single test? Design your environment in a way that the tests will be your default. In my case I use Exercism, but there are plenty of platforms out there that can help us with this task. They provide the exercises already with a set of predefined tests and we just need to create the implementation to turn them green :).
Do you have other techniques to beat procrastination while preparing yourself for your next job opportunity? What are for you the most difficult aspects of preparing for an interview?