With Test-Driven Design’s focus on testing (it’s all in the name), it’s easy to fall into common mistakes and bad practices which can often waste development time and energy, as well as frustrating your programming processes.
For some time now, Matheus Marabesi, Software Craftsperson at Codurance, has been fascinated with anti-patterns in Test-Driven Development (TDD), leading him to bring them all together in his new e-Book:
Why you should read this book
The simple answer is that it will really help you with your TDD and coding.
This book is primarily aimed at anyone who uses TDD in their day to day work.
But, I am going to suggest that you read this book regardless.
Here at Codurance, TDD is one of the fundamental ways that we work so for us, it’s second nature. Talking with our Craftspeople about TDD, I have always been struck with how excited they are by the way TDD helps them write great code.
By working in small, manageable increments, with each increment being thoroughly tested before moving on to the next, TDD helps us catch issues early in the development process, making it easier to fix them before they become bigger problems.
Because of this, even if you are unfamiliar with TDD or at the early stages of using it, it’s worth reading this book because this is actually when you need to be able to recognise anti-patterns that waste your time and energy.
Matheus has a way of thinking that comes through in his writing. He sets up the problem, shows you a relevant example and then takes you through code that highlights the issue and how to fix it.
This is a book you can dip into and I know that this is going to become the go-to reference book on anti-patterns, but be aware, this book is compulsive. You are going to read one anti-pattern and next thing you know, you've read three or four.
How do I know which anti-pattern I’m caught up in?
Matheus has listed the different anti-patterns in the main contents so if you know the name you can find it easily.
"Well, if I knew what I didn’t know, I would already know it". I’ve said that a few times when trying to describe something to google in order to find the answer and anti-patterns are no different.
So, if you aren’t sure as to which anti-pattern you are looking for, Matheus has grouped the patterns into different levels, starting at Level I which focuses on those that you will experience when you start to test-drive your code.
How do I get out of the anti-pattern that I’m stuck in?
Each anti-pattern is described by Matheus in simple terms with examples of code and where possible he also includes suggested further reading, links to his video series or research, should you want to delve deeper.
At the end of each example Matheus also lists the key points that you need to pay attention to in order to avoid falling down this particular rabbit hole, again.
But I’m code-adjacent, why should I read this book?
So am I and I loved this book. It’s been a long time since I last wrote any serious code, but I was drawn to Matheus’ descriptions and the story that he tells about the different anti-patterns.
For me, working daily with Software Craftspeople, here at Codurance, the main reason for reading the book was to understand how they think and code.
But then, I started to see patterns in these anti-patterns that you can apply to different settings such as project management and even my own behaviours.
"Local Hero" will resonate with project managers who have been told that a system has been thoroughly tested, only to discover that it fails when deployed live. Further investigation often reveals that only a single scenario was tested, and it does not accurately reflect real-world usage.
How can I get more comfortable with TDD?
I can’t recommend our kata coding katas enough along with our screenkata series on YouTube. Our katas can be sorted by difficulty and coding type so you can pick the one that is just right for you.
How this book came about
Back in late 2021, Matheus sent out a survey, worldwide, to anyone interested in and/or using TDD in their workplace.
The results of the survey (which are in the first section of the book; A Case for TDD Anti-Patterns) helped to shape the Testing Anti-Pattern Workshops that Matheus then ran during 2021/2022 and are available, on-demand, on the Codurance YouTube Channel.
In these workshops, Matheus explored the origins, history and pitfalls of anti-patterns.
The survey and workshops became the basis for this e-book:
Want to keep in touch and find out when our next e-books are published? Then sign up for our fortnightly newsletter.