separating different responsibilities into parallel hierarchies
The Tease Apart Inheritance is a big refactoring technique used to separate different responsibilities tangled along a class hierarchy. This refactorization associates two parallel hierarchies through their roots in order to use one from the other. The interface of the root class in the used hierarchy is commonly too general to be employed by the classes below in the parallel hierarchy, where a more specific behavior is needed. This paper describes a design that, using two parallel class hierarchies, allows recovering the specific interface of each corresponding class in the parallel hierarchy, improving the collaboration between both hierarchies. Although different implementations of the proposed design are discussed, the use of generics offers the robustness of static type checking and better runtime performance.
refactoring generics design patterns parametric polymorphism software design