locked
Implementing 3 tier architecture RRS feed

  • Question

  • User1281245994 posted

    Hi All,

    I want to create a project in ASP.NET where I can implement 3-tier architecture. The server for UI,BAL and DAL should be different. But I don't know where to start. Can anyone provide me any tutorial over that. The question is not about creating BAL,DAL and UI in a same project and putting the BAL,DAL files in different folders in app_code folder. I want to know how I will implement 3-tier architecture in a big real life projects. If you can please provide me a sample project.

    Thanks in advance.

    Bhaskar

    Thursday, February 25, 2010 6:37 AM

Answers

  • User-952121411 posted

    You are wanting advice on how to create a 3-tier physical structure; while splitting each logical layer out and placing on its own physical tier has a 'few' advantages, you need to be well aware of the disadvantages.  For that, please read the following link, and look at an excerpt from this link to see what I am eluding to:

    "Crossing a boundary is expensive. It is on the order of 1000 times slower to make a call across a process boundary on the same machine than to make the same call within the same process. If the call is made across a network it is even slower. It is very obvious then, that the more boundaries you have the slower your application will run, because each boundary has a geometric impact on performance."

    Should all apps be n-tier?

    http://www.lhotka.net/WeBlog/PermaLink.aspx?guid=efa88d0a-2388-4909-bee1-c9bddb6e9868

    With that being stated, I don;t really know of a 'tutorial' on setting up all the different servers for a distributed system like this.  In some ways it is more of an infrastructure project than a software one.  Once you have all the software consuming and talking to all of the pieces, then it is a matter of getting them all spread out each on its own tier.

    My advice, unless you have an application with some seriously heavy usage and need some real scalability in terms of performance, I would not venture down this route without knowing exactly what you are doing.  If you heard about a true n-tier physical design and though conceptually it sounded like a good idea, and wanted to implement it, make sure you understand the downsides of it 1st.

    Hope this helps! Smile

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 25, 2010 3:22 PM

All replies

  • User-2004844803 posted

    Hi,

    I dont really understand why you make a differnce off a "big real life project" and placing the code in app_code? IIS is already an excelent Application server that are more then capable to run all your logic (from data access to UI). Keep in mind that moving data between your layers are always much faster if all your logic run in the same application domain.

    Then, offcourse, there are times when you for some reason need to split it and run it on different servers. If this is what you need to do I suggest that you look in to WCF. Thats really all you need to setup communication between your layers. Just google it and you will find tons off good reading like:

    http://msdn.microsoft.com/en-us/library/ms734712.aspx

    http://www.c-sharpcorner.com/Articles/ArticleListing.aspx?SectionID=1&SubSectionID=192

    Happy coding!

    Thursday, February 25, 2010 9:18 AM
  • User48953143 posted

    Hi,

    Following is the step by step process.


    1: first of all you add asp.net website.

    2:Then right click on solution and add new project.now this time add class library.name it DAL for Data Access Layer to put the Data Base Processes classes.

    3:Then right click on solution and add new project.now this time add class library.name it Entities or BAL for put the Entities or business process classes in this project.

    4: now add the reference of 3 project to 2 and first.

    5:add the reference of 2 into 3rd.

    6:usually entities project have no raference of anyother project.


    rebuild and use them.



    Thursday, February 25, 2010 1:31 PM
  • User-2004844803 posted

    Following is the step by step process.

    This is the way to do if you want to run everything on a single IIS server. If you, on the other hand, wants to split it up on different tiers (servers) you need to run your DAL and BAL (or whatever layers you need to separate to this tier) in a WCF service (likely, but not a must) hosted on either IIS or WAS.

    Thursday, February 25, 2010 2:27 PM
  • User-1199946673 posted

    http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=416

    Also, take a look at the website of Rockford Lhotka, where he talks about his CSLA.NET Framework.  

    Thursday, February 25, 2010 3:01 PM
  • User-952121411 posted

    You are wanting advice on how to create a 3-tier physical structure; while splitting each logical layer out and placing on its own physical tier has a 'few' advantages, you need to be well aware of the disadvantages.  For that, please read the following link, and look at an excerpt from this link to see what I am eluding to:

    "Crossing a boundary is expensive. It is on the order of 1000 times slower to make a call across a process boundary on the same machine than to make the same call within the same process. If the call is made across a network it is even slower. It is very obvious then, that the more boundaries you have the slower your application will run, because each boundary has a geometric impact on performance."

    Should all apps be n-tier?

    http://www.lhotka.net/WeBlog/PermaLink.aspx?guid=efa88d0a-2388-4909-bee1-c9bddb6e9868

    With that being stated, I don;t really know of a 'tutorial' on setting up all the different servers for a distributed system like this.  In some ways it is more of an infrastructure project than a software one.  Once you have all the software consuming and talking to all of the pieces, then it is a matter of getting them all spread out each on its own tier.

    My advice, unless you have an application with some seriously heavy usage and need some real scalability in terms of performance, I would not venture down this route without knowing exactly what you are doing.  If you heard about a true n-tier physical design and though conceptually it sounded like a good idea, and wanted to implement it, make sure you understand the downsides of it 1st.

    Hope this helps! Smile

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 25, 2010 3:22 PM
  • User-2004844803 posted

    unless you have an application with some seriously heavy usage and need some real scalability in terms of performance,

    Just a thought here, I faced this problem a while a go when I was about to set the design for all our customer sites. We have about 100 different sites that we build and host for our customers. All these sites share the same data but the presententation is way different. The first thought was to separate the data access into its own physical tier serving all front end web servers with data. This would allow us to cache data down in the "data tier". After some redisign we decided to not split into a separate tier but run all layers on IIS and use the memcached server as a separe cache server serving all web servers with cahced data. A very sucessfull soultion!

    Friday, February 26, 2010 2:50 AM