Learning: Separation of Layers

One of the greatest strengths of eZ publish is the way it cleanly separates layers.

In traditional software architecture, there are 4 layers

  • User Interface
  • Business Logic
  • System Interface
  • Data Access & Storage

The theory is that each layer should be independent from the other layers so that changes can be made within a layer without affecting the rest of the system. Also known as the “black box” concept, that is, the inner workings of one layer is like a black box to the other layers. The benefit of this is that each layer can be updated, modified or replaced without having to change any of the other layers. Eg. a particular solution might use Postgres as a part of the data access layer but the client has decided that they want to move to Oracle. If the business logic layer has been cleanly separated from the data layer, it means that only the data layer has to be modified to work with Oracle instead of Postgres.

Unfortunately, in many web applications, the presentation, business logic and data access layers become intermingled making it difficult to update and modify without running into trouble. eZ publish solves this by ensuring the layers are cleanly separated. This means you can change one layer without impacting the other layers. A common example is that you can change the entire look and feel of a site quickly and easily without affecting the rest of the system.

The way eZ publish achieves this is through the use of designs, templates, content classes and extensions.

  • The user interface is created through a combination of design & templates
  • Business logic is created through sections, access control and extensions
  • Data access is built into the framework

Initially it’s not obvious as to why this idea of separation of layers is so powerful. When initially building a system, allowing the layers to be mixed might lead to a quicker result, it’s not until working on larger systems with many developers or once the system requires updates and maintenance that the layered approach proves to be far superior. The benefit of the eZ publish framework is that the layered approach is built in.