Class Hierarchy Merge

Let's learn about the class hierarchy merge design pattern.

We'll cover the following...

The Class Hierarchy Merge design pattern

Consider the simple class hierarchy of the design model in the subtypessubtypes figure, which shows a disjoint segmentation of the class Book. Whenever there’s only one level (or a few levels) of subtyping, and each subtype has only one (or a few) additional properties, we can refactor the class hierarchy. This can be done if we merge all the additional properties of all subclasses into an expanded version of the root class so that these subclasses can be dropped from the model. This will lead to a simplified model.

This Class Hierarchy Merge design pattern comes in two forms. In its simplest form, the segmentations of the ...