1 / 35

Real Life ASP.MVC

KEA September 22 2011. Real Life ASP.MVC. Christian Dalager, Eksponent ApS. Me. .NET developer, Eksponent ApS Lead on Arena365.com C#, Ruby, Java, PHP, Perl Background in Nordic Language and Literature + IT University. ASP.NET MVC. MVC a what??. Model View Controller design pattern

Download Presentation

Real Life ASP.MVC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. KEA September 22 2011 Real Life ASP.MVC Christian Dalager, Eksponent ApS

  2. Me • .NET developer, Eksponent ApS • Lead on Arena365.com • C#, Ruby, Java, PHP, Perl • Background in Nordic Language and Literature+ IT University

  3. ASP.NET MVC

  4. MVC a what?? • Model View Controller design pattern • Separates data, presentation og logic

  5. MVC parts • View • Webforms view engine <%= ”yay” %> • Alternatives: Razor (MVC3), Spark,Nhaml • Controller • Core framework • public class MyController: BaseController{} • Model • ... nothing...

  6. The Missing M • No builtin database/persistence features • Lots of options • Entity Framework / linq2sql • NHibernate / Castle ActiveRecord • Subsonic • External services (WCF i.e) • Home made DataAccessLayer with SQL statements (sooo 2003)

  7. Case Arena365

  8. Arena365.com • Social tool for active lifestyle, for groups and individuals • Track your training, manage your teams • Google maps / Routes • Facebook Integration • Campaigns • 7.500 users

  9. Arena365 DEMO

  10. Arena365 Facebook, RSS, Maps, Twitter, GetSatisfaction, MailChimp. Console App Views JSON iCal XML CSV ViewModels Windows service CMS Controllers Service Service Service Repository Repository Repository Repository Database Cache NHibernate

  11. Building blocks • DI Containers • Logging • Caching • Error reporting • Mail sending • Facebook integration • iCal feeds • Import routes • Import RSS • CMS functionality • Security/ACL • Build scripts • UnitTests • Source Control

  12. Show me the code! • # lines of C# code (LOC) 17 157 • # lines of comment 4 010 • Percentage Comment 18% • # Assemblies 11 • # Namespaces 112 • # Types 1 185 • # Methods 7 658 • # Fields 3 284

  13. Complex Systems are.. complex • Requirements change over time • Build for change • YAGNI (you aint gonna need it) • Pragmatism vs Idealism

  14. Arkitektur

  15. http://www.iwaysoftware.com/solutions/by_integration/DataIntegrationSolutions.htmlhttp://www.iwaysoftware.com/solutions/by_integration/DataIntegrationSolutions.html

  16. http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_EndUser/GC_Hdwr_UG/ch01.htmlhttp://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi?coll=linux&db=bks&fname=/SGI_EndUser/GC_Hdwr_UG/ch01.html

  17. http://www.elbet.rs/sport_betting_software/

  18. Hands-on Agenda • Skinny controllers • ViewModels • Dependency Injection • AutoMapper • ModelBinders

  19. Architecture i MVC ASP.NET MVC Controller View Model

  20. ArchitectureinMVC ASP.NET MVC Data / Business logic Controller Domain model View DB ViewModel

  21. ViewModels • Flattenedclasses • Tailor made for views • Projections

  22. /product/list

  23. /product/show/3

  24. /product/edit/3

  25. Skinny Controllers • Keepyourmethods small • Keepyourdependencycountdown • Keepyour controllers skinny • Benefits • Reusability • Testability • The essentialsmayalwaysfityour screen

  26. TIME TO DO THE CODES

  27. DependencyInjection

  28. AutoMapper

  29. ModelBinders

  30. Arkitektur

  31. Solution-layout

  32. Ask Questions • How big is thisbeastgonnaget?! • How manyentities do you have? • How many controllers willyouneed? • How long do youexpectyourapp to live? • Are theremanystakeholdersthattogetherdefine the projectscope? • Will the projectchangedirectionsbeforeit’s done? (Funding will do this to you) • Is the project an exploratoryjourney or do youknowexactlywhereyouwill end? • How manyintegrationpoints do you have?

  33. Thank you. I love you<3 • christian@eksponent.com • Blogdalager.com • Tweetstwitter.com/dalager • Source Code / Presentationbitbucket.org/dalager/ • Job?job.eksponent.com/

More Related