Advantages of TDD

TDD comes with advantages and disadvantages. These are the main advantages:

  • You only write code that is needed: Following the rules, you have to stop writing production code when all your tests pass. If your project needs another feature, you need a test to drive the implementation of the feature. The code you write is the simplest code possible. So, all the code ending up in the product is actually needed to implement the features.
  • More modular design: In TDD, you concentrate on one micro feature at a time. And as you write the test first, the code automatically becomes easy to test. Code that is easy to test has a clear interface. This results in a modular design for your application.
  • Easier to maintain: As the different parts ...

Get Test-Driven iOS Development with Swift 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.