what is difference between 1,2 or 3 tier architecture and n tier architecture
Ajeet
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nattudurai EswaramurthyPosted Aug 13, 2012, 2:58 AM
so adding more layrers make it n-layered solution not a n-tiered solution.
adding so much layer may increse the complexity of your solution so try to avoid a lot of layering in the solution also.
Normally, Application divide their layers into two broad categories
1- Horizontal Layers : These layers are used to provide the application wide functionality and they can be re-used in different solutions example of layers are
a- Logging Layer b- Security Layer
2- Vertical Layers : These are the layers which actually logically creates your application e.g. UI , Business Logic , Data Access and theoratically these layers can also be used in similar applications with some changes. Horizontal layers are used across by the vertical layers.
1
down vote
accepted
The "n" in n-tier basically means "a number you choose", so you could called it multiple-tier architecture. Normally, this manifests itself in three tiers. Display, Logic and Data.
This could be implemented in many different ways, as you mention - you've seen it in action where the web page has the display function, a web service has the logic function and the database satisfies the data tier.
N-Tier is an architecture, so it can be applied to any language / technology. It isn't quite a design pattern, but the principle behind it is the separation of concerns between data, logic and presentation. The difference between N-Tier architecture and a design pattern is that with N-Tier, it is describing a physical hardware separation as well as code-unit separation. A design pattern would be concerned about the code design, but not the server design.
It places constraints on the developer to limit the responsibility of the code to specific concerns in each of the layers.
i.e. :
View layer deals with making things effectively presented and validate the input and prepare it for use inside the application
Service layer will capture the "Business Rules" i.e. the logic in the reltions and transformations of the objects.
Persistence Layer will limit itself to getting data from and to long term storage, usually a database.
By limiting the responsibilities code in each layer becomes clearer and more focused and it is easier to reason about (at the expense of additional plumbing).
N-tier application architecture provides a model for developers to create a flexible and reusable application. By breaking up an application into tiers, developers only have to modify or add a specific layer, rather than have to rewrite the enitire application over, if they decide to change technologies or scale up. In the term "N-tier," "N" implies any number -- like 2-tier, or 4-tier; basically, any number of distinct tiers used in your architecture. Application architectures are part of Layer 7 of theOSI model.
Ajeet SinghPosted Aug 13, 2012, 3:23 AM
Akkiraju IvaturiPosted Aug 13, 2012, 3:15 AM
1 tier is where all your code lies in one place like your project will have only aspx and aspx.cs files. This does everything for your UI, Business Logic and Data Access tasks. So all the load lies in one place.
2 tier is where your UI and BL lives in one project and the Data Access is another project. Or UI will be in one project and your BL,DA lives in one project.
3 tier is where UI, BL and DA each lives in a different project or layer. N-tier is you are going to divide the work load in more layers or projects.
The number before Tier shows the number of layers through which your code handles the work load.
Nattudurai EswaramurthyPosted Aug 13, 2012, 2:59 AM
2-tier architecture
In 2-tier, the application logic is either buried inside the User Interface on the client or within the database on the server (or both). With two tier client/server architectures (see Two Tier Software Architectures), the user system interface is usually located in the user's desktop environment and the database management services are usually in a server that is a more powerful machine that services many clients. Processing management is split between the user system interface environment and the database management server environment. The database management server provides stored procedures and triggers
3-tier architecture
In 3-tier, the application logic (or) process lives in the middle-tier, it is separated from the data and the user interface. 3-tier systems are more scalable, robust and flexible. In addition, they can integrate data from multiple sources. In the three tier architecture, a middle tier was added between the user system interface client environment and the database management server environment. There are a variety of ways of implementing this middle tier, such as transaction processing monitors, message servers, or application servers. The middle tier can perform queuing, application execution, and database staging. For example, if the middle tier provides queuing, the client can deliver its request to the middle layer and disengage because the middle tier will access the data and return the answer to the client. In addition the middle layer adds scheduling and prioritization for work in progress. The three tier client/server architecture has been shown to improve performance for groups with a large number of users (in the thousands) and improves flexibility when compared to the two tier approach. Flexibility in partitioning can be a simple as "dragging and dropping" application code modules onto different computers in some three tier architectures. A limitation with three tier architectures is that the development environment is reportedly more difficult to use than the visually-oriented development of two tier applications. The most basic type of three tier architecture has a middle layer consisting of Transaction Processing (TP) monitor technology. The TP monitor technology is a type of message queuing, transaction scheduling, and prioritization service where the client connects to the TP monitor (middle tier) instead of the database server. The transaction is accepted by the monitor, which queues it and then takes responsibility for managing it to completion, thus freeing up the client.
4-tier Architecture
In a 4-tier architecture, all of the data storage and retrieval processes are logically and usually physically located on a single tier. A 4-tier architecture allows an unlimited number of programs to run simultaneously, send information to one another, use different protocols to communicate, and interact concurrently. This allows for a much more powerful application, providing many different services to many different clients. In this application we will have following 4-Tiers
1. Business Object [BO]
2. Business Access Layer [BAL]
3. Data Access Layer [DAL]
4. UI (4-Tier) folder [UI]