The Benefits of Building a Layered Application
The Benefits of Building a Layered Application
During the last two weeks I’m consulting at a customer that built
a very simple application very badly. One of the problems that I found was
the lack of layers separation which made the application very tangled.
One example for that is the calling of stored procedures from UI user
controls. I talked to the managers about that issue and explained the
benefits of building a layered application. This post will explore those
benefits.
Layered Application Pattern
Before talking about the benefits first we need to understand what is
layered application pattern. The pattern is very easy. You separate the
application components to layers. The components in each layer should
be cohesive and should have very close related in their functionality. Each
layer should be loosely coupled to the layers that are below it.
The following figure shows layers:
(the figure is taken form the Enterprise Solution Patterns Using Microsoft .NET
book)
The main subject in layers is dependency management. Every component
in one layer can interact with components in the same layer or components
from lower layers. There are many approaches to layers building but it won’t
be covered in the post. For more details you can read about the subject in
the following books:
- Enterprise Solution Patterns Using Microsoft .NET
- Patterns of Enterprise Application Architecture
The Benefits of Building a Layered Application
- Other applications will be able to reuse the functionality exposed
by your layers.
- You will be able to distribute your layers over multiple physical
tiers. This can make a very good impact on your application by
improving performance (sometimes), scalability and fault
tolerance.
- The maintenance of your application is easier because of the low
coupling between layers.
- Adding more functionality to your application is made easier.
- Layers make your application more testable.
- Building a well formed layers makes the orientation in your
application more easier.
Summary
Lets sum up, the post explained what is the layered application pattern.
It also explored the benefits of building a layered application. Building
layered application can make your life easier. I encourage you to use the pattern.