It was early 2007 when I first saw a guy in short khaki pants and sandals talking about agile design principles. In a funny and theatrical way, he explained the most important aspects of the object-oriented design. Some of the sentences are still engraved deeply in my cerebral cortex. For those of you who would like to hear the presentation, it is still available on InfoQ.
Just recently I was given a birthday gift, a chance to meet Robert C. Martin (aka Uncle Bob), the legend in person. It is very unlikely that you are in programming business and have never heard or read a book called Clean Code or came across the Manifesto for Agile Software Development which Uncle Bob is very well known for. For the first time in Serbia, we were given the opportunity to have a hands-on session with the promoter of SOLID principles and to understand them from the practical point of view.
As a part of the PPP (Principles, Patterns, and Practices of XP) Workshop that was organised by ITKonekt, Uncle Bob presented his skills and the way of approaching and solving specific problems.
In the first part, Uncle Bob used the video store example from Martin Fowler’s Refactoring book and practically showed how it could be covered with unit tests and safely refactored. The final and refactored solution can be found on GitHub.
The second part was purely about following the TDD discipline where Uncle Bob implemented the stack. He showed how to break down the problem, write unit tests as well as minimal production code that makes those unit tests pass. Finally, he refactored the code to make it more readable and maintainable. Everything fell into place so easily and naturally.
In the third and last part, we as participants were organised in pairs and given a task to implement the queue by following the three golden rules of TDD.
Level of commitment for every line of code that Uncle Bob wrote was extraordinary. Even the most complex problem seems to be easily solvable by applying his way of thinking. Apart from the TDD exercising, during the workshop, I was able to recognise the discipline, professionalism and passion that Uncle Bob was led by. Who said that a guy in his late 60’s could not code, and not only to code but to code well :)
Overall, it was a good exercise for those who are familiar with the TDD but not using it in every day’s work. For the experienced TDD practitioners, this was a confirmation of lessons learned. Newbies, on the other hand, had a great introduction.
Uncle Bob shared a great tip that if you want to acquire a TDD skill you have to practice it in your free time, and I cannot agree with him more. Normally, at work, projects do not allow us to practise TDD or to practise it well enough to learn such a skill. The best way is to learn it on your own. My experience showed that practising TDD for 30 mins a day for 30 consecutive days will give you enough confidence to apply TDD in your every day’s work. Starting with small katas and progressing to more complex and real-life features should be the way to go.