This session was conducted by the famed Scott Hanselman. I had been looking forward to this session since I heard he was speaking – one, to meet him, and two, to learn about the MVC framework and design pattern. I had been neglecting my duties as a technologist to follow up on MVC, and this was my time to catch up. Besides, we had already bumped into Scott at the Scavenger Hunt, and he was pretty cool about that.
Here are my notes from the session about ASP.Net MVC and the design pattern
- MVC is a new web project type for ASP.Net
- This type of project is more easily testable
- It is not a replacement for web forms
- This is only an option
- SCOTT HANSELMAN IS HYSTERICAL!
- You must be using .Net 3.5 to be able to create ASP.Net MVC Application Solutions
- Select a testing framework (nUnit, WatiN, etc.)
- 3 new namespaces – System.Web.Mvc, System.Web.Routing, System.Web.Abstractions (Now part of ASP.Net)
- The framework plays well with others – NHibernate for Models, Brail for Views, Whatever for Controllers
- Clean separation of concerns – easy testing, red/green TDD, highly maintainable by default
- Extensible and pluggable
- Clean URLs and HTML – SEO and REST friendly URL structures
- Great integration into ASP.NET
- MVP (Presenter) vs MVC (Controller)
- Request into controller, then to the model for data, then send the data to the View for display
- The http handler does all the interpretation
- Routing is kind of like URL Rewriting – define routes, and the URLs will redirect you to where you need to go
- NHaml, Nvelocity – open source view engines
- ViewEngieneBase – extend to make all kinds of views, iCal, vCard, RSS, etc, etc.
- System.Web.Abstraction – Testing without firing up IIS
- RhinoMocks, TypeMock, nMock, Moq – all kinds of mocking frameworks to use with the abstraction namespace
- TDD – write tests first. You want to see them fail, then write the least possible to make the test pass. Write, rinse, repeat.
I couldn’t believe the amount of information Scott covered. He explained the MVC pattern, the new .Net framework, the new namespaces, gave examples of routing patterns, how to use different view engines, how to mock, and TDD. This was by far one of the best sessions for me in the entire conference.