11. Designing for Test-Driven Development
In the preceding six chapters, we’ve taken the specification for a product and turned it into a working iPhone app, using the principle of test-driven development. It’s time to take a step back, look at what we’ve done, and see what general guidelines can help in designing classes that will be implemented using a test-driven approach.
Design to Interfaces, Not Implementations
Whenever you’re writing a test in a TDD project, you’re designing a part of the class that is being tested: what setup it needs, how its API can be used, and what the class does in response to its API being used. It’s best to stay away from decisions about how the class does what it does when writing the test, and defer these decisions ...
Get Test-Driven iOS Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.