Home » Archive

Articles Archive for July 2007

design »

[25 Jul 2007 | Comments Off on Designed vs. Open Inheritance | ]

I like Martin Fowler’s write up on Designed Inheritance, but I’m not so sure I agree with his implied suggestion that you cannot have designed inheritance and provide an enabling design.
If I have a component that is being called by other code, and that component is implemented as an abstract class that only allows subclasses to implement abstract methods (all concrete methods are final), then I cannot override the behavior of the parent class. This is designed inheritance because people can only subclass it in the way that I’ve …

design »

[25 Jul 2007 | Comments Off on Don’t mercilessly refactor unit tests! | ]

I teach TDD courses, and one of the questions that inevitably pops up is whether you should refactor your tests. When it comes to eliminating duplication in tests, my threshold is very high. By that, I mean that the most important thing to me is readability. I want to read a test like a mini story: I set this up, I execute this, I verify that.
One of the biggest annoyances I encounter with experienced TDDers is when they decompose tests to the point where you can’t see what the …