24 02 2009
Starting with ASP.NET MVC
About a week ago I started learning ASP.NET MVC framework. It is pretty cool entertainment for cold winter nights as I found out. Here you can find how I got started and what resources I used.
Here are the steps I made to get started:
- I installed last versions of Visual Web Developers 2008 Express Edition and ASP.NET MVC framework.
- I tried out some simpler examples to find out how things work and how code is organized.
- I decided to write a little, simple and minimalistic pet portal that looks like real thing. This keeps me away from simple-sample-code mode, so I have to deal with every detail.
- As a first thing I played with routings to find out how they work and how it is related to code. Okay, I had my own idea what kind of URLs I like and I achieved it without any additional extensions.
- Then I started to play with controllers and views. I wanted to find out how the code is executed and how I can write my own code to make things happen. It is also important to play with views because things are different than in case of usual ASP.NET pages and user controls.
- Next thing was including models, so instead of VC I have MVC in my application.
- Currently I’m integrating AJAX and validation framework to my MVC application.
It is good to learn new stuff as much as possible. I refactored my code more than one time – it is really good refactoring training, believe me.
Why should one consider using ASP.NET MVC framework? There are some reasons I found to be important enough to write up:
- MVC pattern keeps your code very well layered.
- Your code can be easily tested (by example: unit tests, integration tests).
- You have better control over your mark up and you can optimize it the way you like it.
Of course, there are scenarios when classic ASP.NET web applications are better choice. If you have data intensive applications like intranets or other special purpose applications then you may want to use also very powerful UI components from 3rd party providers. Of course, all these things are also possible on MVC framework – just find components you need or write your own components and go live. 🙂