2 Architectural Considerations for the ASP.NET MVC Framework Jeffrey Palermo Chief Technology Officer Headspring Systems Austin, TX Session Code: ARC402
3 Architecture? What type are we speaking of? - Application architecture - Enterprise applications (lots of code)
4 2 Types of Applications Disposable vs. Long-Lived
5 Disposable Architecture Pros Fast to create Great tool support Small applications deployed quickly Doesn’t require highly skilled personnel Trades long term TCO for short term gains when there is no “long term” Cons Rewrites are inevitable Imminent “wall” at some level of complexity Management often doesn’t acknowledge system is disposable Trades long term TCO for short term gains Technology changes require system rewrite
6 Long-lived architecture Pros System serves the business for a long time Return on investment increases over time Easily maintained/changed System survives technology upgrades Cons Tooling support is fragmented Requires skilled architects Not compatible with all organizational cultures Is not popular Requires constant vigilance
7 What's the difference? Separation of Concerns Coupling Duplication of Logic Others....
8 Disposable ASP.NET MVC Application
9 Which is better? For short-lived or tiny applications, it makes no difference.
10 Why use a web MVC Framework? Scale with Complexity Long-lived applications Long-term productivity/maintainability Enable clean separation of concerns Testable by default (built with TDD in mind) Supports Inversion of Control containers Flexible, clean url schemes (think SEO)
11 What is ASP.NET? ASP.NET HttpApplication HttpContext HttpRequest HttpResponse HttpRuntime HttpUtility IHttpHandler IHttpModule WebForms Server Lifecycle Postback ViewState ASPX MasterPages Themes, Skins General Templating
12 What is ASP.NET MVC? ASP.NET HttpApplication HttpContext HttpRequest HttpResponse HttpRuntime HttpUtility IHttpHandler IHttpModule Mvc Routes Controllers ViewData Filters ASPX MasterPages Themes, Skins General Templating
13 Traditional Layered Architecture Data Business Logic UI Infrastructure
14 Web Service File Solution Structure Client Business Logic Data Access DB Infrastructure
15 Layered Onion Architecture Domain Model Domain Services Application Services User Interface Infrastructure Tests DB Web Service File Application Core
16 Web Service File Solution Structure Client Core Infrastructure DB IoC Container
17 Covert to a long-lived application
18 Long-lived Controller Do’s and Don’ts Do Keep them small Depend only on explicit dependencies Leverage the model (the rest of the application) Use explicit parameters Don’t Lift the 300 lines from Page_Load and drop them in an action Call out to infrastructure directly Use ADO.NET Use Nhibernate/Linq2Sql/EF types
19 Know What Type of System You Need Do you need a short-lived, disposable system? Do you need a system that needs a long life?
Related Content Breakout Session ARC401 Architectural Concerns for Object/Relational Mappers (O/RM) with Examples in Nhibernate Thursday, 10:15AM Interactive Theater Sessions WUX08-TLC TDD, DI, and Other Acronyms with ASP.NET MVC Friday, 1PM-2:15PM
21
22 About me CTO, Headspring Systems Software management consultant Agile coach MCSD.Net Microsft MVP, ASPInsider Certified ScrumMaster Director, Austin.Net User Group Board member, AgileAustin INETA speakers bureau U.S. Army Veteran Party with Palermo Agile Boot Camp:
Tech·Talks Tech·Ed Bloggers Live SimulcastsVirtual Labs Developer’s Kit, Licenses, and MORE! Resources for Developers
24 © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.