none
N - Tier vs MVC architecture... RRS feed

  • Question

  • This is a pretty easy question I think I am just looking to make sure I understand things correctly.

    *  N-Tier architecture, is layered with the top most layer being the presentation, or the userland. the middlemost layer being the applcation or logic layer. and final the lowest layer being the data and storage layer. the user land can not or shouldnot talk directly to data layer. sound right?

     

    * where as, MVC is more of a triangle, with each "bubble" not really layers doing its own job and talking to the other bubble as needed?
    sound correct?

    from a security standpoint woudnnt an N-tier be better? and what are the pros and cons of each? and can you combine them? and if so why would you

    -Nex6

    Monday, May 10, 2010 11:04 PM

Answers

  • At a very high level I would agree that you have an understanding of the n-tier and MVC models.

    As far as can they be combined - yes and very often they are.  Typically the entire MVC implementation sits in the presentation layer of an n-tier solution.

    • Marked as answer by Nex6 Tuesday, May 11, 2010 4:01 PM
    Tuesday, May 11, 2010 2:20 AM

All replies

  • At a very high level I would agree that you have an understanding of the n-tier and MVC models.

    As far as can they be combined - yes and very often they are.  Typically the entire MVC implementation sits in the presentation layer of an n-tier solution.

    • Marked as answer by Nex6 Tuesday, May 11, 2010 4:01 PM
    Tuesday, May 11, 2010 2:20 AM
  • They are not interchangable, because it's like comparing apples with oranges. An N-tier architecture is an architecture that is distributed over multiple physical or virtual machines and connected by the network. What you are talking about are called layers. Layers define a logical separation in your architecture with clear roles and responsibilities. In most modern systems, you'll find a presentation layer, a service layer, a business layer and a data layer. A layered architecture requires that  each layer only communicates with the lower layers.

    MVC, like MVP, PM and MVVM, are nothing more than a presentation pattern. The M stands for Model and refers to whatever comes out of your service or business layer.


    Dennis Doomen
    Principal Consultant at Aviva Solutions
    Blog, Twitter, Fluent Assertions
    • Proposed as answer by DennisDoomen Tuesday, May 11, 2010 6:29 PM
    Tuesday, May 11, 2010 5:44 AM
  • The differences between webforms and MVC lie in different areas. 

    Webforms is quicker and easier to write but hard to implement automated testing.

    MVC can handle high IO better but can mean compromises on human interface.

    You need higher quality staff to write MVC apps.

     

    So if you have high quality staff and a high throughput project and need automated testing then MVC is a likely candidate.

    If you don't have great staff or don't have a need for huge throughput or don't need automated testing then webforms.

     

    Tuesday, May 11, 2010 10:25 AM
  • Greetings,

    Selection of an N-Tier architecture mainly depends on the bussiness requirment of the client. Always involve the developers(ie.brilliant developers) in your technical decisions.

    Your main focus should be the bussiness requiremnt should match the archtiecture that you are going to design.

    Please take  the inputs from the major stake holder in the project and come to a conclusion. 

    The MVP design pattern can be used inside the N- Tier Software Archtiecture. You should have an open discussion with fellow developers both males and females  for their suggestions and opinions , it will help you alot in understand things in a wider prespective.

    All the best.

    Take Care

    PL

     


    Helping People To Solve Technical Problems
    Tuesday, May 11, 2010 3:21 PM
  • Hi All,

    Andy wrote "MVC can handle high IO" and has high throughput.

    Can somebody please explain this a bit more. As per my understanding, the base of performance/response time is less number of layers in addition to other things like optimised database, queries etc.

    In MVC, when we are adding three layer for which we can have 1-2 layers, atleast from layman prospective, i can say that it would be slow/equal to the webform performance.I can't hardly say this as i haven't seen any production site made in MVC which was earlier in webforms.

    Needs more inputs on this

    Cheers

    TicArch

    Thursday, May 20, 2010 2:52 AM
  • I disagree with Andy. The choice between MVP, MVC or PM doesn't affect the performance characteristics at all. The overall architecture and the way the system is distributed has a lot more impact. For instance, if you use web services to connect your ASP.NET site to back office systems, or an internal application server, you really have to think about the protocols used, the granularity of the data, etc. The database queries can also have a lot of impact, but all depends on what kind of queries you do. Having a command-query separation such as advocated by the CQRS architecture or introducing caching on multiple tiers can do a lot as well.


    Dennis Doomen
    Principal Consultant at Aviva Solutions
    Blog, Twitter, Fluent Assertions
    • Proposed as answer by DennisDoomen Thursday, May 27, 2010 5:54 AM
    Thursday, May 20, 2010 6:49 AM
  • Yes you're comparing apple and oranges when discussing n-tier vs MVC. As Dennis mentioned MVC may lead you onto to talking about CQRS but MVC can certainly run happily in an n-tier arch.

    The terms n-tier vs n-layer are a problem too bacause although Dennis is accurate in the definition the term has been abused so much that they've become (incorrectly) interchangable. So you always have to qualify it these days.

    ASP Page life cycle vs MVC can impact performance both in terms of live execution and time to implement but in skilled hands the difference should be insignificant. I do not believe that MVC requires higher skilled developers, once a page-life cycle page gets complicated you certainly need a developer who knows what they're talking about.

    So listen to Dennis ;)

     


    http://pdkm.spaces.live.com/
    Friday, May 21, 2010 4:14 PM
  • Hi,

    I want to use MVC in my current application along with other layers like DAL.Somewhat confused on whether to depict Model in Business layer or seperately as it serves same purpose as Business lyaer.

    Common layered architecture without MVC is like http://eed3si9n.com/layered-architecture

    Do we have some diagram on net or in your repository where MVC is depicted in layered architecture along with other layers like DAL, Business rules etc.

    Kindly help

    Cheers

    Thompson

    Sunday, May 23, 2010 3:39 AM
  • MVC is *just* a pattern for the presentation layer. It's a plumbing mechanism to show data in such a way that has the added advantage that you can easily test the UI logic without the problems of automating the UI. If you like the idea of commands and Task based design then take a look at CQRS for alternative ideas to implementing the traditional layers.

    BTW I much prefer MVC to ASP.NET page life cycle so I would encourage you to investigate it further, but it's not a silver bullet. Look out for Fat & God Controllers

     


    http://pdkm.spaces.live.com/
    Sunday, May 23, 2010 8:38 AM
  • You don't think the amount of data sent between client and web server is ever significant?
    Monday, May 24, 2010 10:36 AM
  • It is. In fact, that's why Fowler has defined the Data Transfer Object that is specially suited for combining and flattening data from your domain model or database in a format that is nice for networks. Using DTOs can really improve the overal performance of your system, just like caching in the presentation tier, or a 2nd level cache in your ORM solution on the business tier.

    But the fact that you use DTOs or other ways of communication between tiers has nothing to do with the presentation pattern. The Model in MVC is simply the data you're are showing into the user interface. Whether it comes from DTOs, data sets or your domain model is irrelevant.


    Dennis Doomen
    Principal Consultant at Aviva Solutions
    Blog, Twitter, Fluent Assertions
    Monday, May 24, 2010 12:15 PM
  • So you still can't think of any reason why there would be more traffic between a web server and client for webforms over MVC?

    PS

    Since when would a DTO be going to the client?

    Monday, May 24, 2010 6:45 PM
  • Ah, you were referring to the traffic between the web server and the browser. I thought you meant the traffic between the web server and the application server. That's why I was referring to the DTOs.

    Regardless, if you're unexperienced you may get a slight performance hit by uncontrolled usage of view state. In ASP.NET MVC you'll have more control over the exact HTML that is rendered into the page. But an experienced Web Forms developer will know about those issues and deal with it. The pattern itself does not really have any impact on the performance. The only thing I can think of is that the view state needs to be parsed when the page is posted. But that all depends on what the page logic is really doing.


    Dennis Doomen
    Principal Consultant at Aviva Solutions
    Blog, Twitter, Fluent Assertions
    Monday, May 24, 2010 6:56 PM
  • Just to confuse things further, you could be sending DTO to the client as javascript objects, but that still doesn't affect this use of WebForm or MVC. However, IMO MVC lends itself to AJAX whereas it's a bit of a cludge with WebForms 
    http://pdkm.spaces.live.com/
    Tuesday, May 25, 2010 8:44 AM
  • Agreed. Especially since we have JQuery it has become increasingly easier.

    I wonder if the original poster is still ready this thread...:-)


    Dennis Doomen
    Principal Consultant at Aviva Solutions
    Blog, Twitter, Fluent Assertions
    Tuesday, May 25, 2010 8:52 AM
  • yea, I am still following...   lots of good information.  tho, I am not a N-teir or mvc expert so this type of back aqnd forth is very good to see.

    -Nex6

    Friday, May 28, 2010 5:20 PM
  • If you are looking for a generic application server for developing n-tier systems, have a look at the "cc devnet Data Access Server". This component provides an out of the box server that does everything you need from your middle tier, including support for middle tier objects. A c#, .Net library is provided for Windows clients and support for iOS and Andriod clients is via RESTing. On data side it works with the free open source Firebird Server and SQL Server. Also has built-in support for managing server side files.
    Sunday, March 23, 2014 5:29 AM
  • N-Tier pros and Cons

    Pros

    : Business layer could be put behind the firewall.

    : Application is scalable.

    : Business logic could be easily shared across applications.


    Cons

    : More development time

    : Impact on performance due to involvement of remote call across tiers.

    :Need to protect the data passed between web and business tier.

    MVC is presentation layer framework and in 3 tier architecture is your first tier.

    Monday, April 14, 2014 5:41 PM
  • I think you're confusing tiers with layers...although I'd be the first to argue that the mistake is made so often it's hardly worth mentioning

    http://pauliom.wordpress.com

    Tuesday, April 15, 2014 12:20 PM