An Attempt to Explain the Joy of ASP.NET MVC Development

October 31, 2013 // Tagged in: technology, software, web, mvc

This post is a follow-up to An Attempt to Explain the Pain of SharePoint Development to show that I'm not all pessimistic, and that there are parts of my job that I really enjoy.

The Development Environment

If you're developing an ASP.NET MVC web application, you're probably running Windows and Visual Studio. This means you can run your application directly on your local host with pretty low overhead. If you have a connected database, this can be run on a local SQL Server, or it can be on a shared SQL Server on another machine. This keeps the environment very low overhead.

The Development Process

Visual Studio 2010 was great. 2012 is awesome. Intellisense has grown to support JavaScript and CSS3, HTML tag auto-correction (i.e., if you change a <h1> tag to <h2>, it will automatically correct the closing </h1> to a </h2>). It also supports javascript mapping files, meaning you get intellisense and syntax-highlighting for javascript libraries like jQuery, Knockout, or any others.

MVC4 supports .NET 4.5, which includes support for C# 5. This means you can also use the Razor syntax for the view engine, which, in my opinion, is so much nicer than the older aspx syntax.

A Tasty Cake, With Layers

MVC is really just a pattern of development with a lot of the dirty work hidden for you in a project structure. You can separate your models, views, and controllers into logical groups, with a nice flow between them to structure your project. You can implement other patterns on top of it if you want, like the repository pattern for data access. Authentication is simple, by simply decorating action methods with authentication attributes.

When searching for information about MVC, it's incredibly easy to find information - the simplicity of the structure means easily structured and questions, and verbose, meaningful answers (especially on StackOverflow), and there are lots of blogs and posts out there all about MVC.

Your views remain clean, your controllers remain concise, meaningful, readable and testable, and your models remain descriptive and simple. Sure, you can build lots of complexity into these, and it's certainly possible to make a messy, unstructured MVC app, but it's also very easy to do it the right way, and end with a beautiful project.

The biggest beneift of this is that you can focus on the logic at hand. You can build your views, focusing only on the View logic, then later focus solely on the controller logic. This kind of development process makes me ooze with productivity. This is especially true if I use Entity Framework in my application, and I can eliminate 90% of the difficulty associated with creating a data-layer.