The design principle “favor composition over inheritance” from the Gang of Four book “Design Patterns” states that a combination of functionality should be made in a flat structure, rather than in a hierarchical structure. This way, the functionality becomes more reusable, and the combination more flexible.
The principle is originally meant for software architecture but it also applies to data architecture. In this article we will show how the principle could be applied to the main data architecture of Sitecore: templates.
Templates in Sitecore have the following features:
- Templates can inherit from other templates
- Templates can inherit from more than one generation of other templates
- One template can inherit directly from more than one other templates