Under the Bridge

Review: Test-Driven iOS Development

So we imagine that if you’re reading this, chances are that you’re pretty confident in your programming skills and figure that the optimal development methodology is for people to stay out of your way. We understand. Spent better than two decades repeatedly proving so, in fact. But recently we’ve been shipping additions to a growing family of generally accoladed sports apps; and that has demonstrated to us nicely that the problem with that approach is that it scales past a single app … questionably. At the moment with nine teams in three sports things are still reasonably manageable, but that won’t last, if you get our drift. So we have been looking into things we can do to optimize the scaling process. Which, serendipitously, brings us to Graham Lee‘s new book:

We’d actually talked with Graham briefly after his TDD presentation at the Seattle VTM conference last year, where he’d just about convinced us that TDD might be something other than the development-slowing waste of time we’d previously observed it to be at places that applied it as a management-imposed afterthought, so we had fairly high expectations of the book; and why yes, yes indeed it would be an excellent book even if it wasn’t the one and only out there for iOS on the subject — matter of fact, we unconditionally recommend it to anyone who wants to be a better iOS programmer!

If you’ve already got the TDD religion from other platforms, you can jump directly to Chapter 4 “Tools For Testing”; those of us of a more skeptical bent will find reading through Chapters 1-3 an nice gentle progression through demonstrating the value of testing at all through to “How to Write a Unit Test” and how that leads to safely refactorable design.

Said Chapter 4 goes over the Xcode built-in support thoroughly and introduces GTM, GHUnit, CATCH, and OCMock on the coding side, plus Hudson/Jenkins and CruiseControl on the integration side. That covers anything you’re even remotely likely to encounter in existing projects.

Chapter 5 “Test-Driven Development of an iOS App” starts the 6 chapter process of developing BrowseOverflow, a StackOverflow question browser; full source available on github for everyone. Note that we say “process of” rather than “walkthrough of” developing; these aren’t 5 chapters of simple lecturing, at every step the analysis and alternatives are discussed thoroughly, with asides on design patterns, refactoring, and all kinds of good stuff, finishing up with Chapter 11 on general design principles derived from the process, thoroughly applicable even if you’re not using TDD at all.

Finishing up the book, Chapter 12 “Applying Test-Driven Development to an Existing Project” gives some straightforward advice on grafting testing into your ongoing development, and Chapter 13 “Beyond Today’s Test-Driven Development” surveys techniques not fully baked for iOS development yet.

Overall, we’d say that pretty much every — no, seriously, pretty much every — iOS programmer would solidly benefit from reading this book. Even if you’re already developing with solid test coverage, there’s almost certainly some insights here you’ll find useful. And if you’re in the position of most of us where you’re using tests half-heartedly and more likely not at all, you should put reading this to figure out just how this TDD thing could do you some good at the top of your list of self-improvement tasks. And if you’re new to development in general, why then this should be pretty much the next thing in your programming curriculum after design patterns!

UPDATES:

TDD – is it worth it? nicely summarizes why TDD is very likely worth the trouble to adopt.

0