N Tier Architecture

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 31

N Tier Architecture

Click to edit Master subtitle style

11/22/12

What N Tier Architecture?

N-Tier architecture is an industry-proved software architecture model, suitable to support enterprise-level client/server applications by resolving issues like scalability, security, fault tolerance and etc.

11/22/12

How is N Tier Achieved?


Firstly we need to clarify the difference between two terms in N-Tier architecture: tier and layer. Tier usually means the physical deployment computer. Usually an individual running server is one tier. Several servers may also be counted as one tier, such as server failover clustering.

11/22/12

How is N Tier Achieved?


By

contrast, layer usually means logic software component group mainly by functionality; layer is used for software development purpose. software implementation has many advantages and is a good way to achieve NTier architecture. Layer and tier may or may not exactly match each other. Each layer may run in an individual tier. However, multiple layers may also be able to run in one tier.
11/22/12

Layer

11/22/12

What are the different Layers?


Presentation Business

Layer

Logic Layer

User Centric Layer Data Centric Layer

Data

Access Layer

11/22/12

What is the Presentation Layer?


The

presentation layer presents data to the users. It does not have any other purpose. There should not be any business logic in the presentation layer. say should not be because typically this is where most applications start running into trouble. They start putting business logic into the presentation layer, and then maintenance problems start popping up.
11/22/12

What is the Presentation Layer?


The

presentation layer will also catch unexpected application errors and gracefully handle them and display them to the user. say gracefully because that application should not do what many applications do, which is to display an error and then promptly shut down, causing the user to lose all of their work up to that point. That is not exactly the right way to handle application errors!
11/22/12

What is the Business Logic Layer?


The

business logic layer contains all of the application's logic. That is, the business layer validates all of the data entered into the system. should put all of the logic into the logic layer. You should also place a subset of that into the database. And some of the logic errors that a user can cause should be reported immediately, but you should also place that logic in the business logic layer the user-centric part of that layer.
11/22/12

You

What is the BLL User Centric Layer?


The

user-centric business logic should, in a perfect world, check for only one thing: that the data falls within the limits of the database constraints. types of checks would generally be to validate the maximum length of a string or that a value cannot be null. If there is a column defined in the database as varchar(20) and the user enters a value that is 26 characters in length, this would violate the database constraint
11/22/12

These

What is the BLL User Centric Layer?


.

The reason for these checks being performed in the user-centric logic is mostly for performance reasons. Why should the application make a call to the remote components if there is absolutely no possibility of the data being right? It simply wastes processing power on the server and network band -width.

11/22/12

What is the BLL User Centric Layer?


Another

reason is to give immediate feedback to users on mistakes they have made. When I talk with users about how they want errors reported to them, they mostly say they want to know when they have an error immediately after they make it. In most cases, this just is not practical in a distributed application, but the usercentric logic helps you move toward the user's needs.

11/22/12

What is the BLL Data Centric Layer?


The

data-centric business logic contains all of the application's logic. It contains both database constraint validation and true business logic validation. of the rules that are checked in the usercentric component must also be checked again, and all of the rules stored in the database should be checked here as well.

All

11/22/12

What is the BLL Data Centric Layer?


The

real power of the data-centric business logic is its ability to get information from the database in a fast manner to validate the data stored in the object.

11/22/12

What is the Data Access Layer?


Finally,

we come to the data layer, which in this case is the database. The database consists of tables of data, stored procedures, views, and various mechanisms to constrain the data entered into the tables.

11/22/12

What is the Data Access Layer?


The

only business logic contained in the database should be the logic associated with the table columns , as mentioned previously. One important thing to consider when designing the database is how tightly the data layer is tied to the data-centric objects.

11/22/12

11/22/12

Benefits
Loosely

Coupled

N-tier applications are loosely coupled , which means that the different parts of the application (presentation, business logic, and data) are basically independent of each other. For example, the data sits in a database on the server, and any application that wants to use it can.

11/22/12

Benefits

The business logic processes data and for the most part does not care in which type of database the data is stored or through which type of interface the user enters the data. The presentation layer displays data. It does not care about the data itself or the application logic because it does not process or manipulate the data.

11/22/12

Benefits
Encapsulated

All of the functionality of each layer is encapsulated in one location within the application. If you wanted to change the business logic layer, instead of replacing several parts of the application (as you would have to do with a twotier implementation), you only need to replace one small section that does not affect the presentation or data layer. The same goes for replacing or altering parts of the data or presentation layers. 11/22/12

Benefits
Scalable

Scalability is really what makes an application an n-tier application. All of the other benefits are applicable to both three-tier and n-tier applications. Scalability is the ability of an application to grow and handle more load than it was originally developed for. This is an important point because an enterprise application is rarely built to be used by 500,000 people in the beginning.

11/22/12

Benefits
Usually,

the number of users ramps up gradually as the business realizes how valuable the application can be to other parts of the business. You should design all three-tier applications to move to n-tier applications. make an application scalable, it must be able to have its business logic spread out over many machines and have this location be transparent to the user interface and the database.
11/22/12

To

Benefits
If

you design the application correctly using .NET, you do not need to do additional work to move the application from three tiers to n tiers. "Exploring How .NET Scales Applications" section explains how .NET implements this scalability.

The

11/22/12

Benefits
Extensible

An n-tier application can be extended transparently . That is, you can add additional functionality without breaking the existing functionality. In part, you can achieve this using an objectoriented design when building any size application, but even this does not keep you from having to rework large parts of the code in a twotier application to add functionality. With the three-tier design, you can add11/22/12

Benefits

Maintainable

So, how does having three tiers make an application more maintainable? It helps in speed of change and cost. If a business rule changes, the business logic layer can change easily enough you do not need to re-deploy the application. What if the business decides to move to a Webbased system? If everything is coded in the forms, the task is impossible, and it is better to rewrite the application. If the presentation layer is separate from everything else, then you only have to code up the navigation and forms, but the bulk of the 11/22/12

Benefits

Let them have access to your components or, with .NET, build a Web service (you will write and consume your own Web service in Chapter 11, "Web Services and the UDDI"). In a two-tier application you would have to provide the other application with the logic that you use and then they would have to incorporate it in their application. This sounds like a simple prospect because you do not have to do any work.

11/22/12

Benefits
But

what happens when the business logic changes? Then, not only do you have to change your code, but so does the other application. Trying to keep these changes in sync is impossible in a large enterprise (or even a small enterprise).

11/22/12

1 Tier Architecture
A

single-tier architecture is an architecture in which the entire application resides on the user 's machine. Before networking became so easy and cheap, this was frequently the design of choice. you will find this architecture used rarely and almost never in conjunction with enterprise data. The obvious drawback to single-tier architecture is that the data lives on a local machine, and no one else can access it.
11/22/12

Nowadays

1 Tier Architecture
In

a fast-moving enterprise where information is everything, this is not a good situation. advantage to this architecture, from a developer's standpoint, is that it is relatively simple to code. The developer does not have to worry about security, concurrent access, network connectivity, or any of a hundred other issues that plague multitier applications.
11/22/12

The

2 Tier Architecture
Simply

put, a two-tier architecture is one where the application runs on the user 's machine and the data is stored in a central location on a network.

11/22/12

3 Tier Architecture
A

three-tier (or n-tier , I explain the difference shortly) application is when the application components are spread out over three or more computers and there is a high degree of separation between the user interface, business logic and data access, and the data components.

11/22/12

You might also like