N-tier Architecture ©NIITN-tier Architecture/Slide 1 of 26 Objectives In this session, you will...

26
N-tier Architecture ©NIIT N-tier Architecture/Slide 1 of 26 Objectives In this session, you will learn to: Identify the types of application architectures Identify the need for an n-tier architecture model Identify the features of the n-tier architecture model Identify the advantages of using n-tier architecture Identify the steps to develop an n-tier model

Transcript of N-tier Architecture ©NIITN-tier Architecture/Slide 1 of 26 Objectives In this session, you will...

N-tier Architecture

©NIIT N-tier Architecture/Slide 1 of 26

Objectives

In this session, you will learn to:

Identify the types of application architectures

Identify the need for an n-tier architecture model

Identify the features of the n-tier architecture model

Identify the advantages of using n-tier architecture

Identify the steps to develop an n-tier model

N-tier Architecture

©NIIT N-tier Architecture/Slide 2 of 26

Application Architectures

Applications are developed to support organizations in their business operations. The functions performed by an application can be divided into three categories: user services, business services, and data services.

Application architectures are of the following types:

Single-tier

Two-tier

Three-tier

N-tier

N-tier Architecture

©NIIT N-tier Architecture/Slide 3 of 26

The Single-tier Architecture

In the case of a single-tier architecture, a single executable file handles all functions related to the user, business, and data service layers. Such an application is also called a monolithic application.

The following figure depicts the components of the single-tier architecture:

Single-tier Architecture

User Services

Business Services

Data Services

N-tier Architecture

©NIIT N-tier Architecture/Slide 4 of 26

The Single-tier Architecture (Contd.)

Examples of single-tier architecture can be found in some of the very early COBOL programs performing extremely mission-critical operations.

N-tier Architecture

©NIIT N-tier Architecture/Slide 5 of 26

The Two-tier Architecture

The two-tier architecture divides an application into the following components:

Client

Server

The client implements the user interface.

The server stores the data.

N-tier Architecture

©NIIT N-tier Architecture/Slide 6 of 26

The Two-tier Architecture (Contd.)

The following figure depicts the components of the two-tier architecture:

The communication between a Web browser and a Web server is an example of client server architecture.

User tier Data tier

Server

Business logic

Client

Two-tier Architecture

N-tier Architecture

©NIIT N-tier Architecture/Slide 7 of 26

The Three-tier Architecture

In the two-tier system, the actual processing of data takes place on the server. Therefore, the data has to be transported over the network. This leads to increased network stress. To overcome these problems, there was a shift from the two-tiered to the three-tiered systems.

In the three-tiered system, there is a clear separation of user-interface-control and data presentation from application-logic. Therefore, more clients are able to access a wide variety of server applications. This leads to quicker development through the reuse of pre-built business-logic components and a shorter test phase because the server-components have already been tested.

N-tier Architecture

©NIIT N-tier Architecture/Slide 8 of 26

The Three-tier Architecture (Contd.)

The three-tiered architecture is the most popular architecture on the Web. The three-tiered architecture comprises:

The user interface, mostly a Web browser, that processes client requests in the form of HTML/DHTML pages

The data tier that stores data in the database server

The business logic tier, implemented by the Web server that uses scripting languages, such as ASP to perform tasks like form validation

All the three service layers reside separately, either on the same machine or on different machines.

N-tier Architecture

©NIIT N-tier Architecture/Slide 9 of 26

The Three-tier Architecture (Contd.)

The following figure depicts the components of the three-tier architecture:

Three-tier Architecture

User Services

Business Services

Data Services

ClientBusiness Logic

Data Store

N-tier Architecture

©NIIT N-tier Architecture/Slide 10 of 26

The N-tier Architecture

The n-tier architecture is an expanded model of the three-tier architecture.

A typical n-tier model consists of the following tiers:

Presentation logic tier- The presentation layer provides an interface for the end user. This layer generally consists of the windows forms and ASP pages.

Proxy tier and the distributed logic- The proxy layer provides access to distributed components in the n-tier architecture.

N-tier Architecture

©NIIT N-tier Architecture/Slide 11 of 26

The N-tier Architecture (Contd.)

Client interface- The client interface layer represents the end-user presentation, such as the windows forms.

Business tier- The business layer is the most important part of the n-tiered architecture. It contains the business rules and data manipulation/transformation logic.

Data access tier- The data access layer is a reusable interface to the database. It contains the generic methods used to interface with the data.

Data tier- The data layer deals with storage and retrieval of information. Basically, the data tier consists of the database management systems.

N-tier Architecture

©NIIT N-tier Architecture/Slide 12 of 26

The N-tier Architecture (Contd.)

The following figure depicts the components of the N-tier architecture:

Proxy and Distributed Logic Tier

Business Tier Data Access Data TierPresentation Tier

N-tier Architecture

©NIIT N-tier Architecture/Slide 13 of 26

The N-tier Architecture (Contd.)

Each layer of the n-tier architecture performs specific functions. The following diagram depicts the functions performed by each layer:

Business tier

N-tier architecture

View

Distributed LogicConnects to proxy layer to send and receive requests

Presentation logic tier

Proxy tier and distributed logic

Data access tier

Data tier

Client interface

Business objects and rules

Interface with database, handles all input/output operations

Query and data storage

N-tier Architecture

©NIIT N-tier Architecture/Slide 14 of 26

Advantages of Using the N-tier Architecture

The n-tier application architecture helps you to create:

Robust and reliable applications for the Internet

Interoperable applications

Extensible, maintainable, and scalable applications

N-tier Architecture

©NIIT N-tier Architecture/Slide 15 of 26

Developing an N-tier Model

To develop and integrate an n-tier model, you need to perform the following steps:

Create the data tier

Create the database, create tables in the database, and define the primary and foreign keys

Create the data access tier

Create a set of useful and specific routines to interact with the database

Create the business tier

Write useful methods that will conform to the business rules

Write codes to perform server-side data validation

N-tier Architecture

©NIIT N-tier Architecture/Slide 16 of 26

Developing an N-tier Model (Contd.)

Set up the proxy and distributed logic tier

Add the class libraries and Web services to the project

Set up dependencies, protocols, and add references

Create the presentation tier

Create windows forms and add functionalities to the controls

N-tier Architecture

©NIIT N-tier Architecture/Slide 17 of 26

N-tier and Enterprise Applications

Application architecture that handles persistent data and has business logic is known as enterprise architecture.

The persistent data might outlive the hardware or software that was used to collect the data.

There might be changes to the structure of data, for instance, addition of new data or reorganization of data.

The persistent data is associated with specific business logic.

This brings out the need for an enterprise application to be built on an architecture, which allows one component to be modified independently without affecting the other components. Therefore, an enterprise architecture needs to be built on the n-tier architecture.

N-tier Architecture

©NIIT N-tier Architecture/Slide 18 of 26

N-tier and Enterprise Applications (Contd.)

The data of an enterprise application will map to the data tier of the n-tier architecture. For example, SQL can be used to store the data.

The logic to access the data can be implemented in the data access tier. For example, ADO.NET can be used to access the data.

The business logic can be implemented in the business logic tier. For example, Visual Basic .NET or C# can be used to implement the business rules.

The interpretation of the data can be implemented in the proxy and distributed logic tier. For example, C# or Visual Basic .NET can be used to implement the proxy tier.

N-tier Architecture

©NIIT N-tier Architecture/Slide 19 of 26

N-tier and Enterprise Applications (Contd.)

The view of the data can be implemented in the presentation tier. For example, ASP.NET can be used to implement the view. A representation of the enterprise architecture is given below:

Proxy and Distributed Logic Tier(VB.NET or C#)

Business Tier(VB.NET or

C#)

Data Access(ADO.NET)

Data Tier(MS-SQL)

Presentation Tier(ASP.NET)

N-tier Architecture

©NIIT N-tier Architecture/Slide 20 of 26

Summary

In this lesson, you learned that:

Application architectures are of the following types:

Single-tier

Two-tier

Three-tier

N-tier

In single-tier architecture, a single executable file handles all functions related to the user, business, and data service layers.

N-tier Architecture

©NIIT N-tier Architecture/Slide 21 of 26

Summary (Contd.)

Two-tier architecture comprises the following components:

Client

Server

In the two-tier architecture, the actual processing of data takes place on the server. Therefore, the data has to be transported over the network. This leads to increased network stress.

The three-tiered architecture comprises:

The user interface, mostly a Web browser, that processes client requests in the form of HTML/DHTML pages

The data tier that stores data in the database server

N-tier Architecture

©NIIT N-tier Architecture/Slide 22 of 26

Summary (Contd.)

The business logic tier, implemented by the Web server that uses scripting languages, such as ASP to perform tasks like form validation

A typical n-tier model consists of the following tiers:

Presentation logic tier

Proxy tier and the distributed logic

Client interface

Business tier

Data access tier

Data tier

N-tier Architecture

©NIIT N-tier Architecture/Slide 23 of 26

Summary (Contd.)

The data layer deals with storage and retrieval of information. The data tier consists of the database management systems.

The presentation layer provides an interface for the end user into the application. This layer generally consists of the windows forms and ASP pages.

The proxy layer provides access to the next tier in the multi-tiered system.

The client interface layer represents the end-user presentation, such as the windows forms.

The business layer is the most important part of the n-tiered architecture. It contains the business rules and data manipulation/transformation logic.

N-tier Architecture

©NIIT N-tier Architecture/Slide 24 of 26

Summary (Contd.)

The data access layer is a reusable interface to the database. It contains the generic methods used to interface with the data.

Using n-tier application architecture, you can create:

Robust and reliable applications for the Internet

Extensible, maintainable, and scalable applications

Interoperable applications

Application architecture that handles persistent data and has business logic is known as enterprise architecture.

The persistent data might outlive the hardware or software that was used to collect the data.

N-tier Architecture

©NIIT N-tier Architecture/Slide 25 of 26

Summary (Contd.)

The persistent data is associated with specific business logic.

The data of an enterprise application will map to the data tier of the n-tier architecture. For example, SQL can be used to store the data.

The logic to access the data can be implemented in the data access tier. For example, ADO.NET can be used to access the data.

The business logic can be implemented in the business logic tier. For example, Visual Basic .NET or C# can be used to implement the business rules.

The interpretation of the data can be implemented in the proxy and distributed logic tier. For example, C# or Visual Basic .NET can be used to implement the proxy tier.

N-tier Architecture

©NIIT N-tier Architecture/Slide 26 of 26

Summary (Contd.)

The view of the data can be implemented in the presentation tier. For example, ASP.NET can be used to implement the view.