In virtually every project I've ever worked on, there will be one or two classes with the following properties:
- Extremely large with many many members and methods.
- Many other classes inheriting from this class.
- Many other classes otherwise depending on this class.
Bad design, you might say. But in all cases, this wasn't the case at design time. The classes just grew organically over time and became the proverbial 'God class'. This has been such an invariant of my experience with large software projects that I have to ask:
- Is it possible to foresee likely dependency magnets and design software in such a way that the chance of such classes manifesting themselves is less likely? If so, specifically, how?
- Or, does it simply require ruthless refactoring as time goes by?
- Or, is there some technical solution or design pattern which can mitigate the problems caused by such classes?
- Or, a combination of all three?
Tips, experience and ideas welcomed!