One of the key problems in software development, especially framework development, is finding a flexible and future proof architecture. The architect basically needs to have a crystal ball to see the future. There are some techniques and development choices which can reduce the costs of change but it is inevitable that you will hit a limit eventually.
In this post I am going to talk about 1 architectural pattern which can extend the lifetime of a framework significantly. That pattern is the ‘Onion Architecture’.
The ‘Onion Architecture’ is a pattern originally composed by ‘Jeffrey Palermo‘ and it basically says: put the conceptual model and services in the inner most layer and provide the implementation for the conceptual model and services in the outer layers together with the user interface, data access layer and other implementation details which are subject to change.
The further away from the core a layer is, the more likely it is to change and the easier to change.
A layer in the ‘Onion Architecture’ can interact to any layer below it, including the core. However, it can’t interact to any layer above it. This guarantees that more outer layers can be changed without the need to change an inner layer.
One important detail is that a layer isn’t the same as one component. Each layer can contain multiple components, like the image below demonstrates:

Thanks to Jeffrey Palermo for this image
In short, the ‘Onion Architecture’ allows you to:
- Effectively and logically separate concept from implementation.
- Create a dynamic and future proof architecture.
- Replace outdated or ‘rotten’ layers.
- Introduce new components to layers without changing the inner layers
That is it for now; I hope this post gives you a better insight in how to prepare your architecture for change and extendibility. If you have any question please feel free to ask them!
Sources
