Welcome to Vishwa's blog - Technology, Spirituality and More...

Understanding 3 Tier vs. 3 Layer Architecture

The terms tier and layer are frequently used interchangeably, but actually there is a difference between them: Tiers indicate a physical separation of components, which may mean different assemblies such as DLL, EXE etc on the same server or multiple servers; but layers refers to a logical separation of components, such as having distinct namespaces and classes for the Database Access Layer (DAL), Business Logic Layer (BLL) and User Interface Layer (UIL). Therefore, tier is about physical separation and units of deployment, and layers are about logical separation and units of design.

Creating a multi tier project design is more suitable and advisable to mid to large-size projects, whereas a good multi-layered design is suitable for small to mid-size projects.

Let’s understand this difference more closely with my earlier posts on “Developing 3 Tier Application in .NET 2.0”. In reality this example is 3-layer architecture because all the layers are logically separated but stay in one code. Following are the namespaces of each layer

1. Vishwa.Example.Data
2. Vishwa.Example.Business
3. Vishwa.Example.WebSite1

The final DLL contains all the above layers: Vishwa.Example.WebSite1

Now, let’s think how to build the same project in true 3-tier architecture. For simple understanding, each layer will be moved to a separate project and thus creating following three dlls. These dlls can stay on the same machine or different servers.

1. Vishwa.Example.Data.dll     --- see  Data Transfer Objects (DTO) - Data Access Layer
2. Vishwa.Example.Business.dll --- see Data Transfer Objects (DTO) - Business Layer
3. Vishwa.Example.WebSite1.dll  -- Now you can refer the above new dlls to perform the same operation

But, by just moving the code of each layer into a separate project will not work, because first and foremost issue is: each layer depends on other layer, so you can not compile one project without other one and here you are in catch 22 situation.

So you will require changes into current design. Also, if you are not planning to keep all the layers in the same folder of your application, then another big issue- how to refer and communicate with each layer’s object. Here is some approach you can take for each layer to convert into a tier model.

  • Literally, create a separate project for each layer.
  • For Database Access Layer and Business Logic Layer ASP.NET Web Services or .NET Remoting can be used. If you can use .NET 3.0 Windows Communication Foundation (WCF) Services, that will be great, they seem to me like Web Services but more powerful, secure and flexible than Web Services.
  • User Interface Layer will stay as ASP.NET Web Site but some changes will be required for invoking or calling Business Objects. However, existing BLL and DAL layers will be removed from current project.
  • Additionally, I will recommend using Microsoft Enterprise Library - Application Blocks for .NET 2.0. This library can help you to build a robust application, it provides solutions to common development challenges such as data access, logging and user interface etc. You can find more information at
  • By using (Web) Services, you will move one step towards Service Oriented Architecture (SOA), which is becoming more popular now in enterprise application development.
You must be wondering why did I use the word 3-Tier instead of 3-layer?

First of all most of the time people are searching on key words like 3-Tier rather 3-Layer. Word 3-tier architecture is most frequently used but heavily misused in IT industry. So it is easier to bring people to the information they are looking for and then educate them as what exactly it means.

Needless to say that it was easier for me to take a simple example for 3- layer architecture design and explain each layer step by step. Developing a true multi tier approach may look like over killing of the sample project. I may write one sometime in future:).

Comments (14) -

  • Hemant

    10/23/2007 9:16:50 AM | Reply

    First of all I would like to thank you for the very nice article.
    You have recommended to use Microsoft Enterprise Library because it provides common development challenges.
    I appritiate that and I am preaparing to use Microsoft Enterprise Library 3.1 but what are the licencing issues,
    can I distribute the Assemblies along with my application?
    Can I extend the methods in the Enterprise Library 3.1?

    Waiting for your reply.

  • Hemant

    10/23/2007 9:22:37 AM | Reply

    Very Nice article.
    I am using the same concept of Tiered architecture.

  • virender

    7/12/2009 2:39:11 PM | Reply


    First of all thanks for your article. on internet most of articles on n-layer & n-tier describe same n-layer design BBL,DAL,DTO,Presentation Layer.
    but no articles about "N-tier Architecture-Physical separation of components on multiple server". My problem.

    Our Team developed a project with following n-layer with one solutions project. currently application running on one web server. but on that portal   4000-5000 user access their accounts information in one time and day by day portal performance decreasing due to user increase. so,  we need increase performance . Currently using following layer.

    1. Presentation layer
    2. Business Layer
    3. Data Transfer object
    4. Data Access Layer

    For good performance we need physical separation of components on multiple server . It it possible or not ? If possible then how  or it is better way. please help me.

    Presentation layer, - Server1

    Business Layer ,
    Data Transfer object(DTO)- Server2

    Data Access Layer - Server3

    Sql Server 2008 – Server4
    (Database Server already running on separate server)

  • Vishwa

    7/13/2009 2:47:55 AM | Reply

    Yes, separation of each layer is possible with cost of serialization/de-serialization and network latency.  What I would suggest you to add a service layer in front of Business Layer. Keep your layer 2 and 3 together in same tier along with business layer so that performance will be less affected in data transfer between layer 2 and 3. For cleanness, you may opt keeping each layer in diff assembly but physically together in one tier.
    Let’s say you have an App Server containing all the business objects, which will be accessed through one or more WCF Service.  Now you can use the WCF Service through multiple protocols as it suits your need with any kind of presentation layer. If you ever required exposing any method to a web service you can do that using same business objects.
    Please keep in mind, every tier you add will negatively impact your performance, but positively affect your security concerns if properly designed.  I think 3 tiers will be sufficient to handle the load and you may be able to scale up as well as scale out with this design.

  • Christof

    7/18/2010 6:55:21 AM | Reply

    Thanks for good explanations. I have a trouble about configurating of layers of my project. I have 3 layer; I)Presentation (Winform project), II)Business (Wİnform or WebService project?), III)Data Access (Winform or Web Service project). Normally, my application is a WinForm application. But, in order to use "click-once" and keep my DataAccess layer in my server, I have to use a Web Service project as Business or Data Access Layer. But, I am very confused, which layer should I use as Web Service? There is all data access methods and command builder in my Data Access layer. On the other hand, in Business Layer, there are subcontractor methods only. Which one is better as Web Service? a) If I use Business Layer as Web Service, Business and Data Access layer is located on my Server. b) If I use Data Access layer as Web Service, Presentation and Business layers located on apolication's published exe a user use and only Data Access layer is located on my Server. Is there performance differences between a and b?
    Thanks in advance...

  • Vishwa

    7/18/2010 8:16:16 AM | Reply

        Your Presentation Layer is Winform Project, thats all right, now you are introducing a web service, means Technically you are adding a service layer. So Your PL will talk to Service and Service will internally talk to Business and Data Layer. Here are 2 options for you.

    1. Keep the Service Layer in Seperate Assembly and put Business and Data Layer in one Assembly. This option will be efficient. In Service Layer you provide operations based on Application's need and Business Layer according to Business Need. This is called seperation of concerns.

    2. Keep Service, Business and Data in 3 seperate assembly. However you may get a slight latency because 3 hops.

    Do not use Web Service for Data or Business Layer. Try hiding your Business Model from caller of web service otherwise any change in BL will directly impact the caller.

    Service model is actually used for service layer which sits on the top of Business Layer. Business Layer comes from Object Oriented Design and Service Layer comes from Service Oriented Design. The best form is using the Hybrid model to gain the best of both.

    The most important thing is to be able to seperate Presentation and Service/ Business Layer so that if you are using WCF, it can act as App Server for you. Also keeping service layer, business layer and data layer together is not a bad idea as well. It is upto you how you want to achieve the same goal and how much flexibility you need to provide in application. There is no one design which best fit for all scenario.

  • Christof

    7/18/2010 9:16:05 PM | Reply

    Hi Wishwa,
    thank you very much for clarifying me. Your explanation is very nice. I think as you said using Business, Service and Data seperately cause a little bit latency. On the other hand I think if I add Service Layer as a new layer (4th layer), it also cause latency even if so little. My thinking is that (if there is a improper approach, please warn meSmile
    1) I.Layer is Presentation and WinForm project type. I use all the methods and procedures related to user interface in this layer. I access to the II.Layer also from here by a WebReference.

    2) You are right about WebService, but in my Business Layer, there are only some of the simple method which are just a bridge between Presentation and Business layers. I do not use any Data Access methods or query in this layer. All the data manipulation methods are in Data Access Layer. So, I  think Business Layer can be used Service Layer and there is no need create a new assembly for that. I mean that; I will move all the things in Business Layer(project type : WinForm) to a new Business Layer (project type : Web Service)project and delete the first one. So, the II.Layer will be Business Layer in Web Service project type.

    3) III.Layer is DataAccess Layer and WinForm project type. It contains all the data access methods and Typed Datasets.

    4) I use TYPED Dataset and I need to return this typed dataset to the I.Layer. So, I think I have to create this kind of typed Dataset in the I.Layer. Is it ok?

    What do you think about the 4 section above? I will look forward your opinion in order to have a fast start to my project Smile Your suggestions is a powerful light for me on this point... Thanks in advance.
    Best regards...

  • Vishwa

    7/19/2010 1:12:14 AM | Reply

    If you have a small application and using Typed DataSet then you just layer your all code in same assembly just keeping them logically seperated e.g. making respective folder for each - business, data and service etc.
    Typed Dataset are not recommeneded in enterprise environment but you can happily use in small apps. Also I am not sure if you are using the web service for the UI or different purpose. As a general practice if you are creating a seperate assembly for business or data, you should create that project as Class Library not win form unless you have everything in the same.

  • Christof

    7/19/2010 2:06:26 AM | Reply

    Hi again,
    my application is neither big nor small actually. I wanted to build a 3 layer(or 3 tier) application. The main reason I use Web Service is that; I will use Click Once, and there is only Application Layer's code in exe file reached clients. I will keep especially my Data Access Layer codes in my server. So, there is 2 seperate section under this conditions; Client and My Server. So, I think I need a communication between this section and I need a web service application which might be used as Business Layer and to connect Application and Data Access Layer (Unfortunately, I cannot use WCF now, maybe later). Is there sny wrong approach related to my prior question? Would you mind to answer them one by one please? Because it is the first time I have been very close to the solution with the help of YOU and, by coming here, I want to complete my undestanding of this architecture. Thanks in advance...

  • Vishwa

    7/19/2010 3:11:48 AM | Reply

    Your #1 is fine, #2 being web service project is ok (you do not need WCF, ASMX is fine), and you are already moving business layer into web service project thats good too. But I do not understand #3 as why you need data layer in winform project?
    You can also move the same into web service project under a folder called e.g. DataAccess. You web service will act as 2nd tier which will have 3 layers (service,business and data) and your 3rd tier will be your database. So you will achieve the same goal you want. I always suggest to Keep it Simple (KIS)approach. Hope this explains you what you wanted.

  • Christof

    7/19/2010 6:34:22 AM | Reply

    Hello Vishwa,
    thank you very much for your kind helps. I think you are right about #3, but before starting to create my project, I thought to build a structure (a framework) which can be used my later project. Firstly, I created my project as a WinForm application and there was no problem. But, when I need to seperate my Data Access Layer from Business and application Layer (from Client's machine) I had to switch one of my layer to Web Service. So, I think Creating Data Access Layer seperately may be better for the next projects. Because, the most important and Unchangeable part of my project is Data Access Layer (most parts of the Select, insert, update, delete methods will be the same). So, I wanted to create it as a sepereta part. But, if you think it is useless, I might move it Web Service project as I moved Business Layer before. What do you think?

  • Vishwa

    7/19/2010 3:33:31 PM | Reply

    I understand its easy to create a WinForm Project with Typed DataSet, kind of easy to test as well, but once you have it working, you can move those classes into your web service project.

  • Christof

    7/19/2010 6:14:37 PM | Reply

    Ok, thank you very much Vishwa. Your suggestions have hepled me to continue on right way. With kindest regards...

  • Ravindranath reddy

    8/10/2010 7:06:23 PM | Reply

    Really superb Explaination. Your Presentation skills are attractive..