I was really looking forward to Kent Beck's Test Driven Development by Example. It was released a while back but quite a lot of experienced programmers still recommend it as a good starting point. So it is great to have it as part of my reading list in early days of my apprenticeship.
I was aware that examples were in Java, and didn't really know what to expect. Having read through most of it I can share that, I found it difficult to follow. Unfamiliar Java syntax had a role to play, however, I think it's mostly because I tried just reading it at first. It sort of made sense to just read it and get the general idea because I wasn't familiar with the language anyway...
Well, that was hard-going. I got through half the book with no real sense of accomplishment. So I decided to take a step back, I started from the beginning, but this time I was typing up the examples, I don't have the environment for Java installed, but I didn't intend to run the code, just needed to type it up and be able to see the code in its entirety. It made a huge difference. I feel I followed better the reasoning because I was able to look through the code, trace the function calls, the whole thing felt so much more tangible. I would certainly recommend this approach, especially, if like me, you have no prior Java experience and are planning to read the book.
Surprise
So far, I certainly have learnt a thing or two about TDD. But there were couple of unexpected things too!
Some of Kent's (I hope he doesn't mind me calling him by his first name) examples demonstrate how ugly control flow can become, and how if possible it can be replaced by polymorphism. That was a eureka moment for me, I sort of understood the concept before, but never made a personal aquaintance, so seeing how powerful it is in practice really made things so much clearer! Didn't anticipate to learn about one of the core OO features while learning TDD.
I am also feeling way more comfortable with Java syntax and that public void...
no longer looks as scary and as dramatic as it sounds. The syntax in general used to intimaidate me whenever I stumbled upon some code snippet in Java.
Oh, wait! Did anyone tell you that by the time you are done with the book you will also be comfortable with Python syntax? Oh yes, because you will have Kent guide you through building your own little test framework, TDD obviously. As he put it it's like "performing brain surgery on yourself"...
As I made these discoveries coming up to and during Easter I see them as little Easter eggs hidden away behind the big title. I hope you will discover some others when you explore this book for yourself!