Testability and Design Evolution

Rafael A. George Duval
2 min readFeb 12, 2024

--

Testable systems guarantee future changes.

Having a testable system doesn’t mean that the design is solid. It will depend on the knowledge of the TDD practice that whoever wrote the code went through. The key benefit is not about adding more tests for the sake of it. The practice relies on decomposing the problem into smaller chunks we can reason about.

The key benefit was that you could only improve your design by making more tests.

A better design is measured by comparing the same problem against two solutions. The suggestion that a system has a better design because it has unit tests must be corrected. This can mean a lot of other problems related to the application’s design.

There’s no room for speculation.

What we write is dependent only on what we define as an example. To understand the point, we need to define what; better design means. This will depend, of course, on the problem, but at least we can determine what good design is.

Good design should always move towards simplification.

There’s a tight relationship between good design and velocity. If the team’s speed can’t be measured or is nonexistent, that means problems with the test suite.

We make design decisions every time we write code, whether using TDD or not.

If your application succeeds, many of your decisions today must be changed later. This is not because of the lack of diligence by the developers but because it is hard to test a system that has yet to be tested. The lousy design comes from doing tests afterward.

Test only some components test-first. Instead, focus on what’s worth testing. I only test for mistakes.

Tests are crucial in documenting and revealing a code base’s inner workings and relationships. Testing is necessary to get feedback and reduce the risk of change. The goal of any software project is to create a structure that is easy to evolve, even when new members join the team, guided by tests.

The ultimate goal is establishing a sustainable development process not limited by tools.

Focusing on the test suite can improve the development environment.

When the code structure is easy to understand, the system can evolve. Yet, tests are code and need maintenance, and over-testing or testing the wrong things can lead to increased development costs.

[¹]: Clean Code: A Handbook of Agile Software Craftsmanship

--

--

Rafael A. George Duval
Rafael A. George Duval

Written by Rafael A. George Duval

✍🏼 Building a Solo Digital Media Company 🧪 Snippets of Text [https://snippetsoftext.substack.com/subscribe]

No responses yet