TDD and the Pressure to Create High-Quality Software
The qualities of testable code are pretty much the same qualities of high-quality software. What does TDD have to do with this?
Join the DZone community and get the full member experience.
Join For FreeBefore test-driven development (TDD), the only thing that applied pressure for high-quality in software development was the knowledge, experience, and commitment of an individual software developer.
After TDD, there was something else.
High quality in software is widely agreed to include the following properties.
High-quality software:
- Is modular.
- Is loosely-coupled.
- Has high cohesion.
- Has a good separation of concerns.
- Exhibits information hiding.
Test-driven development is only partially about testing. Of much greater importance is its impact on design.
Test-driven development is development (design) driven by tests. In test-driven development, we write the test before writing code to make the test pass. This is distinct from unit testing. TDD is much more than “good unit testing.”
Writing the test first is important. It means that we always end up with “testable” code.
What makes code testable? Testable code:
- Is modular.
- Is loosely-coupled.
- Has high cohesion.
- Has a good separation of concerns.
- Exhibits information hiding.
These are precisely the same properties as those of high-quality code. So, with the introduction of TDD, we now have something else beyond the knowledge, experience, and commitment of a programmer to push us in the direction of high quality. Cool!
Published at DZone with permission of Dave Farley, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments