Transcript
Page 1: N-tier Application Developement

N-Tier Application ArchitectureMicrosoft .NET

Muhammad Ghalib Mirza .NET Application Development

Page 2: N-tier Application Developement

Introduction:N-tier data applications are applications that access data and are separated into multiple logical layers, or tiers. Separating application components into discrete tiers increases the maintainability and scalability of the application. It does this by enabling easier adoption of new technologies that can be applied to a single tier without requiring you to redesign the whole solution. N-tier architecture includes a presentation tier, a middle-tier, and a data tier. The middle tier typically includes a data access layer, a business logic layer, and shared components such as authentication and validation. The data tier includes a relational database. N-tier applications usually store sensitive information in the data access layer of the middle-tier to maintain isolation from end users who access the presentation tier.

Page 3: N-tier Application Developement

N-Tier Application :A typical n-tier application includes a presentation tier, a middle tier, and a data tier. The easiest way to separate the various tiers in an n-tier application is to create discrete projects for each tier that you want to include in your application. For example, the presentation tier might be a Windows Forms application, whereas the data access logic might be a class library located in the middle tier.

3-Tier Application :Here I consider a 3 Layered application Design. These 3-Layes are: Presentation Layer. Middle Layer.

Business Rules. Data Validations. Authorization/Authentications.

Data Access Layer.

Page 4: N-tier Application Developement

1.Presentation Layer/UI Layer

This is the top most layer of application where user performs their activity. Let’s take example of any application where user needs to fill up one form. This form is nothing nut presentation layer. In windows application windows form is presentation layer and in web application web form belongs to presentation layer. Basically user’s input validation and rule processing performs in this layer.

2. Middle LayerThis is on top of presentation layer. As the name suggest, most of the business operation performs here. For example, after collecting form data we want to validate them with our custom business rule. Basically we define classes and business entities in this layer.

Page 5: N-tier Application Developement

3. Data Access Layer

It is on top of Business Logic Layer Data Access Layer presents. It contains methods that helps business layer to connect with database and perform CRUD operation. In data access layer generally all database related code and stuff belongs to. Sometimes people use platform independent data access layer to fetch data from different database vendor.

Page 6: N-tier Application Developement

Evolution of n-Tier Application:

The three tier design is the one of the most common best practice design and this is so common that most of the software developers are familiar with the acronym DAL and BAL used to refer to the data access layer and business access layer respectively.

Now look how the application evolves into these tiers.

Case # 1

Page 7: N-tier Application Developement

Evolution of n-Tier Application:

Case #2

Page 8: N-tier Application Developement

Evolution of n-Tier Application:

Page 9: N-tier Application Developement

Evolution of n-Tier Application:

Page 10: N-tier Application Developement

Advantages:

The main benefits of the N-tier/3-tier architectural style are:

• Maintainability. Because each tier is independent of the other tiers, updates or changes can be carried out without affecting the application as a whole.

• Scalability. Because tiers are based on the deployment of layers, scaling out an application is reasonably straightforward.

• Flexibility. Because each tier can be managed or scaled independently, flexibility is increased.

• Availability. Applications can exploit the modular architecture of enabling systems using easily scalable components, which increases availability.

Page 11: N-tier Application Developement

Disadvantages of N-Tier Application Deployment:

• The performance of the whole application may be slow if the hardware and network bandwidth aren’t good enough because more networks, computers and processes are involved.

• More cost for hardware, network, maintenance and deployment because more hardware and better network bandwidth are needed.

Page 12: N-tier Application Developement

Summary:

An N-Tier design can refer to logical and physical separation of responsibilities within an application. The terms tiers and layers may be used interchangeably though each has specific meaning as well. Logical separation in two layers can improve the code maintainability while physical separation into tiers can provide scalability, security and fault tolerance among other benefits. Applications can evolve over the time as their needs require the complexity of an N-Tier design.

Page 13: N-tier Application Developement

THANKS