Dependencies and Layers

Controlling dependencies between features and modules is critical for long term maintainability and flexibility.

When following the Package Principles or traditional modular architecture there exists no layers. Actually modular architecture is often seen as an approach to going away from the traditional 3 tiered architecture (UI, business logic, data). Layers in the Habitat methodology is not this kind of layers.

The layered approach in Sitecore Habitat is aimed at tightly controlling dependencies between modules and thereby is a vital part of the architectural approach.

The structure is split into three layers: Project, Features and Foundation, which all consists of modules.

  • The Foundation layer consists of services which are common across the whole or parts of the solution.
  • Features - or the functionality of the solution - is built as modules in the Feature layer.
  • The unified solution, websites or channels, are brought together in one or more Project layer modules.

The Acyclic Dependencies Principle

The dependency structure between packages must not contain cyclic dependencies. 

The Acyclic Dependencies Principle

The Stable Dependencies Principle

The dependencies between packages should be in the direction of the stability of the packages. A package should only depend upon packages that are more stable than it is. 

Read more

The Stable Abstractions Principle

Packages that are maximally stable should be maximally abstract. Unstable packages should be concrete. The abstractness of a package should be in proportion to its stability.

Read more