Authors:
Francisco Ortin
and
Miguel García
Affiliation:
University of Oviedo, Spain
Keyword(s):
Design patterns, Refactoring, Software design, Parametric polymorphism, Generics.
Related
Ontology
Subjects/Areas/Topics:
Architectural Design and Meta Architectures
;
Cross-Feeding between Data and Software Engineering
;
Design Thinking as a Paradigm for Software Development
;
Paradigm Trends
;
Service-Oriented Software Engineering and Management
;
Software Engineering
;
Software Quality Management
Abstract:
The Tease Apart Inheritance refactoring is used to avoid tangled inheritance hierarchies that lead to code duplication. This big refactoring creates two parallel hierarchies and uses delegation to invoke one from the other. One of the drawbacks of this approach is that the root class of the new refactored hierarchy should be general enough to provide all its services. This weakness commonly leads to meaningless interfaces that violate the Liskov substitution principle. This paper describes a behavioral design pattern that allows modu-larization of different responsibilities in separate hierarchies that collaborate to achieve a common goal. It allows using the specific interface of each class in the parallel hierarchy, without imposing a meaningless interface to its root class. The proposed design is type safe, meaning that the compile-time type checking ensures that no type error will be produced at runtime, avoiding the use of dynamic type checking and re-flection.