What is the difference between layers and tiers


All Questions
ASP.NET
CSharp
SQL Server


All Questions
WCF
MVC
HR Round

Search This Site


Layers refer to logical seperation of code. Logical layers help you organise your code better. For example an application can have the following layers.


1)Presentation Layer or UI Layer
2)Business Layer or Business Logic Layer
3)Data Access Layer or Data Layer


The aboove three layers reside in their own projects, may be 3 projects or even more. When we compile the projects we get the respective layer DLL. So we have 3 DLL's now.


Depending upon how we deploy our application, we may have 1 to 3 tiers. As we now have 3 DLL's, if we deploy all the DLL's on the same machine, then we have only 1 physical tier but 3 logical layers.


If we choose to deploy each DLL on a seperate machine, then we have 3 tiers and 3 layers.


So, Layers are a logical separation and Tiers are a physical separation. We can also say that, tiers are the physical deployment of layers.




Tiers:
1) Presenation Tier or UI Tier (Hosts the Presentation Layer or UI Layer). This can be considered as web server in case of an ASP.NET web application.
2) Application Tier or Business Tier (Hosts Business Layer or Business Logic Layer).
3) Data Access Tier or Data Tier (Hosts Data Access Layer or Data Layer).
4) Database Tier - SQL Server or Oracle (or any other database) which has tables, stored procedures and other database objects.


In general the following are the responsibilities of each layer or tier:


1)Presentation Layer or Tier is usually responsible for interacting with the user.
2)Business Layer or Tier is responsible for implementing the business logic of the application.
3)Data Access Layer or Tier is responsible for encapsulating the code that accesses the persistent data stores such as a relational database.

All Questions
ASP.NET
CSharp
SQL Server


All Questions
WCF
MVC
HR Round

Search This Site

7 comments:

  1. Hello,
    Could you please let me know the difference between 3-tier architecture and MVP pattern
    Thanks,
    P

    ReplyDelete
  2. A MVC architecture is seperated into Model - Responsible the the management of the data, View - Responsible for displaying data in a meaningful way and the controller - that is responsible for the control flow of the application recieving input and interacting appropriatlly with the other layers.

    The most notable difference is that the view (that may be compared to the presentation layer when coupled with the controller) may speak directly to the model (the data).

    This would be a violation of an n-tier architecture. It is however possible to have a MVC architecture within a single tier of a 3-tier architecture. For example your presentation layer may be structured following an MVC architecture.

    ReplyDelete
  3. What are HTTP Modules and HTTP Handlers in ASP.NET?

    ReplyDelete
  4. Very Good article. The explanation is superb ! Keep them coming !

    ReplyDelete
    Replies
    1. Very Good article. The explanation is superb ! Keep them coming !

      Delete
  5. Hi can you please let me know how to deploy 3 different dll's into 3 diff. machines., and how does our app work under N Tier architecture..?

    ReplyDelete
  6. nice and amazed

    ReplyDelete

If you are aware of any other asp.net questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us | Internet Marketing