Saturday, March 6, 2010

Multi-Tier Architecture

What Is Multi-Tier Architecture, And Why Do We Care?
Multi-tier (or n-tier) architecture refers to the practice of separating an application into layers.  Doing so makes it easier for you and other developers to re-use your code.  Typically, a multi-tier application will be broken into three layers:
  • Data Access Layer (DAL):  This layer contains all the code that interacts with the data store used by the application.  For example, if your data store is a typical RDBMS like Sql Server or Oracle, the data access layer will contain the code that calls the stored procedures in your database to perform reads and writes (or if you don't use stored procedures, the data access layer may contain your SQL code).
  • Business Logic Layer (BLL):  This layer contains all the code that implements your application's business rules.  It makes calls to the DAL, usually on behalf of the Presentation Layer (see below).  The BLL typically contains code that operates on the data received from the DAL prior to passing it back to the Presentation Layer for display to the user.  For example, the BLL may perform calculations based on data retrieved from the DAL to be displayed along with the actual data.
  • Presentation Layer:  This layer typically reads and writes to the BLL.  The Presentation Layer is responsible for taking the data it receives from the BLL, formatting it, and displaying it to the user.  It is also responsible for collecting user-entered data and conveying it to the BLL for further processing.  In the .NET world, the Presentation Layer is typically created with either ASP.NET Web Forms, Windows Forms, or more recently WPF (Windows Presentation Foundation).

No comments:

Post a Comment