In n-tier architecture the entire application is divided in several
pieces. These pieces can be logical or physical. Each piece performs a
specific task such as displaying user interface or data access. There
can be any number of tiers or layers of such pieces. Hence, the name
n-tier (Note that many times the terms tier and layer are used
interchangeably). However, most commonly applications have 3 distinct
tiers or layers. They are:
- Presentation Layer
- Business Logic Layer
- Data Access Layer
As you can guess, presentation layer is nothing but a piece
of software that deals with user interface of your application.
Displaying data to the end user and allow them to interface with it is
the core functionality of this layer.
In most of the cases the data entered by the end user needs some
kind of validation or further processing. This is the responsibility of
Business Logic Layer.
Finally, your application data needs to be stored and retrieved
in some data store (RDBMS, XML etc.). This task is handled by Data
Access Layer.
In short, the process works like this:
- User requests for some application data.
- The data access layer retrieves the data and is forwarded to
the presentation layer via business logic layer. Sometimes data access
layer gives this data directly to presentation layer.
- Presentation layer receives the data to be displayed via business logic layer.
- The user changes the data and initiates the appropriate action (such as insert, or update).
- The business logic layer validates the data submitted by the user.
- If the data is valid it is handed over to data