Hi All,
Can anyone tell me the difference between two tier and three tier archieture????????????? and how .net clr works with n tier architecture...........


Plzzzzzzzzzzz help me:sad:

What is N-Tier?

N-Tier is an architecture where logic and processing is distributed among logical and physical "tiers". These tiers can be conceptually seperate, or physically located on different servers and even in different geographical locations.

What does that mean to me?

Seperating logic brings several benefits, especially in the key areas for developers, ie. stability, performance, scalability and maintainability. At the most basic it simplifies the implementation in the same way seperating your code into routines and components brings higher maintainability and (hopefully) less bugs. Seperating the logic in this way also allows you to drop in extra power where it is needed, for example additional database boxes etc.

Tiers on my pillow

So we know broadly speaking what N-Tier is about, but how do we recognise this beast? To explain this it is usually easiest to describe what the other popular tiered architectures are, you will have been using one for years without knowing it.

1-Tier : Single Host

The good ol' days where people thought they only needed one computer for the whole organisation meant that you physically had one tier. Logically the functions could well have been segregated, but in most cases this scheme would be considered one tier. Using Microsoft Access on your own unconnected desktop, or a dumb-terminal based system could well be considered 1 Tier also.

2-Tier : Client Server

Client Server was a major buzzword in the early 90's, taking initially dumb terminal applications and giving them a fancy windows-like front end, using PCs with terminal emulators which presented pretty GUIs or later Visual Basic etc front-ends. This situation varies along a spectrum of intelligent client/dumb server to thin client/powerful server. A web browser talking to a web server is an example of a client talking to a server. Here there is presentation logic (presentation tier) happening at the client, and data/file access (data access tier) and logic happening at the server.

3-Tier : Client/Presentation Layer, Business Logic/Process Layer and Data Layer

The most popular architecture on the web currently, mostly taking the form of web browser processing client side presentation in the form of HTML/DHTML, etc, the web server using some scripting language (our fave ASP) and the database server (SQL Server for example) serving up the data. Various solutions move the bulk of the work around, beginners to ASP often have the ASP doing all the work with the database being little more than a data store. More advanced solutions could have the client doing loads of work with browser based scripting and XML data islands, or at the other end of the spectrum the database powering the whole thing with stored procedures.

N-Tier : The above and more

So, finally, we get to N-Tier, and N-Tier is basically "A number of Tiers", usually an expanded model of 3-Tier. If we take the 3-Tier example above, we have a crude (but workable) starting point, but if we need more performance or scalability (which we inevitably do) there needs to be more refinement.

A good place to start is to move logic out of the scripting language. Scripting languages (up .NET anyway) are not "proper" languages and are usually more solutions for fancy templating, that is presentation layer stuff and glue for components. In an ASP scenario, this would mean the ASP keeps everything talking to everything else, presenting the results from COM components methods calculations, which form the business logic Tier. The COM components could be split into "Process" and "Data Access", the data components knowing how to talk to the stored procedures and the process components doing actions on the data. Once you have a Data Access Tier you could consider if this function should be further split, or perhaps distributed using DCOM or Message Queues.

How do you know when to stop?

Unfortunately N-Tier is being bandied around as "The Solution", as you can imagine it is not "The Solution" it is "A Solution". Work from your requirements. You can usually use common sense, 80% of things naturally fall into groups, the remaining 20% is either sorted by what you know works or what the solution requires.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.