O'Reilly logo

Quality Code: Software Testing Principles, Practices, and Patterns by Stephen Vance

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Encapsulation, Observability, and Testability

All in all, conventional guidance about object-oriented encapsulation creates a tension between good design and testability. The testability of a class directly relates to your ability to verify its state, hidden behind getters and setters, and its behavior, hidden in restricted methods.

In an ideal world, our programming languages would support testability needs. Increasingly, frameworks make provisions for testability and tools leverage language features to increase our ability to test. In the meantime, our job is to find a balance between the rules of good design and the need for verification.

This book advocates using language and tool features where possible to test our code. Where standard language ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required