Clearly this is feedback from The Code. Its trying to tell me that the class in question is too bloated and complicated, with too many responsibilities, methods or members.
I guess the first step is components? I could refactor into components that would have more granular unit tests I guess. But then I'd have to atomically construct several components for it to work - which I'd do in a factory. The system under test would be made of a graph of interconnecting objects. Am I unfairly prejudiced against irreducible complexity, or is this the way of the future?
The question has arisen because I have a bug in an object that requires several steps to initialise. While I may have been aware of this, it wasn't until adding a unit test did I really notice that I didn't know how to construct and configure the object. My factory knows the magic to make it happen, but its not obvious from the interface which is a problem to address.
Now I've spotted the problem I'm going to fix it so that Future Roger will like my code more than I currently like it.
No comments:
Post a Comment