Web development is best suited for those who like continuous learning, you have to with the constant changes in technologies and available frameworks. To get a grip on new technologies and frameworks i often find myself writing code simply to learn and experiment. Now i have decided to combine this experimenting with my blogging by developing a series of articles based on developing a web application using the Asp.Net MvC 3.
The Asp.Net MvC 3 framework
I choose to develop my application with the Asp.Net MvC framework because it enables me to develop high quality web applications. The framework utilizes successful design patterns (Model View Controller) and is build using important object oriented principles and best-practices like separation of concerns, loose coupling and testability. While it may take some getting used to for those coming from Asp.Net Web Forms, the initial learning investment will prove worth while.
The Asp.Net MvC framework recently had it’s third major release, while many new features have been added, there are two new features that got me really exited. First is the Razor view engine, which offers cleaner and “easy on the eyes” syntax for the views. Razor comes with full Intellisense support. The second feature is the NuGet package manager which enables developers to easily manage third party libraries and their dependencies from within Visual Studio. NuGet makes installing and updating off all third party libraries a breeze. We will be working with both these new features during this article series. After discussing the framework let’s talk about the application we are going to build.
Before we begin, the concept behind the application is pretty straightforward. Community demo applications like Nerddinner proved that a simple concept can be effective for those wanting to learn a framework. We are going to develop a community website centered on book reviews. We start simple with the core functionality: write, tag and submit book reviews. As the series progresses functionality will be extended. We will start developing responses to book reviews with a badge/kudos system. We should also implement some membership mechanism like OpenID integration. But before we get carried away, lets actually start by creating the a new project!
Time to fire up Visual Studio and get coding! Make sure you have installed Asp.Net MvC 3 otherwise it will not show up in the project templates when creating a new project. In the project creation screen select the Asp.Net MvC 3 project template. Name the project BookReviews.Web, and the solution BookReviews. In the second screen of the project creation select the select the following settings:
- Project template: Internet application
- View engine: Razor
- Create a unit-test project: Yes
- Test project Name: BookReviews.Web.Tests
- Unit-test framework: Visual Studio Unit Test
After creating the project your Solution Explorer should look like the screenshot on the right, containing the web project along with a unit-test project. The unit-test project offers the opportunity for automated testing. We will start with automated testing in the next article. We will be using automated testing for our routes, ensuring that requests made by users get mapped properly within our application. So this is it for the first article, the next article get will posted within a few days! Feel free to ask questions, feedback is much appreciated.