I’ve been re-reading Evans’ Domain Driven Design recently and, whilst reading one night last week on the train home, something stuck.
It is more useful to make a big impact on one area, making a part of the design really supple, than to spread your efforts thin.
Although I’ve been very lucky in working on things I enjoy, over the past week I’ve particularly enjoyed the work I’ve been a part of. We’ve been trying to make some improvements to a section of code that hadn’t had so many tests around it. Initially, these were used to drive a couple of small refactorings to improve the readability of the class and better separate the responsibilities it had.
So, as good developers some fellow team-members earlier sat down to add good tests around the current behaviour to ensure that whilst things were being moved around nothing broke.
And, because my teammates are all excellent developers, they (and me) spent time ensuring that the tests we wrote were nice and small, communicative and focused. During this time we made sure that our tests were treated with the same respect as the rest of our code, keeping them clean and readable. When the test code got ugly, we refactored our tests (and our design under test) to reflect a cleaner design.
We’ve really felt the benefit of all this work. We started a card that involved adding much more behaviour to the same area of the system. The gateway was getting some brains.
We were able to take the nice, focused, behaviour explaining tests they had started and extend and build upon them easily for the behaviour we were going to add. And, by adding some automated higher-level integration tests, we were able to get even more confidence that we were retaining the behaviour we wanted, and adding the new behaviour we needed.
Thanks to the loving care shown by the previous developers those of us following in the footsteps had a much easier time, and our new design is much more consistent, useful, and ultimately valuable.
Because we chose to make a big impact on a very small area of the system, we felt a large benefit on our productivity. Our tight focus helped us evolve a more supple and elegant design.