It’s one thing to say, “Do test driven development.” But practicing TDD requires a set of tricks — you need techniques to enable test driven development in your particular environment. It’s these techniques which I hope to pass on to you through a case study of building an iOS TDD sample app.
I’ve accumulated a treasure chest of TDD ideas over the years. These ideas are often not my own, but are other people’s ideas which I collect and curate. Some are about object-oriented design. Some are about working in Xcode and Objective-C. And some are particular to iOS development. I’ve collected many, and continue to gather new ones.
I’m building this TDD sample app so that you and I can browse through this treasure chest together. You may have tried test driven development and given up on it. Or maybe you’re still trying, but finding it frustratingly slow. The ideas we will explore together will help you break through to make headway in your TDD journey, so that you can experience the freedom and ease that comes from automated testing and clean code.
[This post is part of the series TDD Sample App: The Complete Collection …So Far]
A worked example can’t be hand-wavy; it needs to be something concrete. I asked you for concrete ideas, and some of you suggested the Marvel Comics API. It looks clean and straightforward, so it should work well for our TDD sample app. Besides, the dataset will be fun!
The Marvel Comics API provides a way to look up comic book characters, so that’ll be the main focus of the app. But let’s break that down further. Here are a few use cases that come from the way we use mobile apps:
This small set of use cases is common to most networking apps. It’ll give us plenty to start with.
Although we have only three use cases, working through them will lead us through many topics, such as:
Despite the numbering, this isn’t an ordered list. Some of the topics are about applying TDD, while others are about design issues. What “test driven development” drives isn’t just code with tests. TDD also drives design. So even though I’m calling this a “TDD sample app,” design issues will weave in & out of the examples.
I may sometimes write something that looks like a digression. As I see it, anything that can help you work more efficiently is fair game. That’s why I wrote 6 Simple Power Tools for Better Git Use; it’s the first set of ideas that came up as I started the Marvel Browser project. But in general, expect a steady flow of TDD examples and related object-oriented design issues.
So get ready! Some ideas will be new to you, and you’ll be able use them immediately. Some techniques may raise questions. When that happens, please raise those questions, because with good discussions, we all win.
To make sure you don’t miss a single post in this series, please subscribe. You’ll receive new posts directly by email. Or if you have already subscribed, can you think of a friend or colleague who would benefit from this series? Then be sure to pass this article along to them.
Question: Which topics do you look forward to the most? You can leave a comment by clicking here.[This post is part of the series TDD Sample App: The Complete Collection …So Far]
Programming was fun when I was a kid. But working in Silicon Valley, I saw poor code lead to fear, with real human costs. Looking for ways to make my life better, I learned about Design Patterns, Refactoring, and Test-Driven Development (TDD). Programming became fun again! I've now been doing TDD in Apple environments for 17 years. I'm committed to software crafting as a discipline, hoping we can all reach greater effectiveness and joy.
Please log in again. The login page will open in a new window. After logging in you can close it and return to this page.