Most Read Latest News Blog Resources

Windows & .NET Watch: MVC wins MVP




June 15, 2009 — 
ASP.NET MVC may have a clunky name, but it’s a great technology. The official line from Microsoft is that ASP.NET MVC is an alternative, not a replacement, for ASP.NET Web Forms, but I don’t expect to use Web Forms as the technology for any new projects going forward.

I’ve argued that “stuff in the right place” may be the defining characteristic of good software—not functionality, nor elegance, nor adherence to any particular paradigm or coding style. What I like the most about ASP.NET MVC is that it creates a nice scaffolding for business Web applications. To be sure, the Model-View-Controller design pattern boasts a purebred heritage going back to Smalltalk and is, probably, the most well-known pattern in object-oriented programming (at least by name if not by structural detail).

ASP.NET MVC may put Smalltalk on its family crest, but it does so by way of Ruby on Rails. Rails has been, without a doubt, a trailblazer and has become my preferred technology for Web development. The trouble with Rails is that Ruby developers have been hard to find, and corporate clients are often resistant toward introducing the Ruby technology stack alongside their existing .NET or Java stacks.

In contrast, a client who had nixed Rails for an upcoming project approved ASP.NET MVC without even a blip of hesitation. The Microsoft brand still means a lot.

When a new ASP.NET MVC project is created, six different folders are generated, with names like App_Data, Controllers, Views and so forth. If you choose to generate a Test project (which you ought to do), your “Project” window will end up being fairly crowded. I have to acknowledge the school of thought that equates “ease” with “fewer files,” and I can imagine a world where we (unfortunately) see newer programmers avoiding ASP.NET MVC because of its inherent complexity.

In truth, navigating an ASP.NET MVC application is less complicated than navigating in most business applications. I have a client whose codebase is so bad that grepping from the root directory is universally acknowledged as the fastest way to find a function definition. Even though that codebase is admittedly worse than normal, it all boils down to “a place to keep your stuff,” and ASP.NET MVC encourages a set of structural conventions that aid the placement of code.

Additionally, the compile-time type information that you get with C# or VB allows Visual Studio to shine when it comes to navigation and code completion. I’m not going to turn in my membership card to the Ruby fan club, but as a team leader, I see ASP.NET MVC and C# as a better match for many teams.

The fundamental principle of MVC is “separation of concerns,” a term familiar in software design and unfortunately rare in Web applications. The Model is the business domain, the View is the Web page, and the Controller is the input channel. Of course, in a good application, there will be further divisions and blurry lines: The Model should abstract data storage, the View will probably be configurable in some ways, and AJAX functionality doesn’t quite divvy up properly. The better the separation of concerns and the more logical the “piles of stuff,” the easier the application is to evolve, maintain and test.

The Model is the place for business rules and the vast majority of data access. ASP.NET MVC uses LINQ-to-SQL for its storage model, which maps the expressive power of Language-Integrated Query to, well, SQL. My personal wish list for ASP.NET MVC might include built-in support for LINQ-to-NHibernate, a more flexible object-relational mapper, but I think LINQ-to-SQL is already a significant win over traditional data-access techniques. (Using NHibernate with ASP.NET MVC seems to be fairly common, but it’s not supported directly.)

My repeated use of the word “simplifies” in my description needs to be taken in the context of real-world development, which is inherently hard stuff. ASP.NET MVC is complex and has aspects, such as request routing and LINQ-to-SQL, that are going to be difficult to just muddle through. There are lots of Web resources and at least one good book, Wrox’s “Professional ASP.NET MVC 1.0,” by a who’s who of heavy hitters: Rob Conery, Scott Hanselman, Phil Haack and Scott Guthrie.

Poor luck has it that the evolution of ASP.NET MVC 1.0 has been out of sync with the beta release of Visual Studio 2010, and for now you can’t combine an investigation of the two. Hopefully, this is a temporary glitch and the framework will be in the release candidate of VS 2010. In the meantime, you can use the Microsoft Web Platform Installer to get ASP.NET MVC into Visual Studio 2008, and I suggest you do. This is the best framework for developing Web applications to come out of Microsoft and I recommend it for new development.

Larry O'Brien is a technology consultant, analyst and writer. Read his blog at www.knowing.net.


Related Search Term(s): MicrosoftMVC


Share this link: http://www.sdtimes.com/link/33530
 

Add comment


Name*
Email*  
Country     


  • Comment
  • Preview
Loading



 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 
Download Current Issue
ISSUE 3/15/2010 PDF

Need Back Issues?
DOWNLOAD HERE

Receive the print Edition?


 
blogs tab
Google Code turns 5
Google Code Turns 5, and adds a Paxos Algorithm to make the system more stable and reliable.
03/17/2010 11:16 AM EST

Test your Visual Studio 2010 know-how
Microsoft is offering free beta certification exams for Visual Studio 2010.
03/17/2010 11:08 AM EST

Microsoft lifts the hood on IE9
Microsoft is previewing IE9.
03/16/2010 01:10 PM EST

 

Events calendar tab
3/22/2010 to 3/25/2010
Santa Clara, Calif.
The Eclipse Foundation

4/12/2010 to 4/14/2010
Las Vegas
Penton Media

4/12/2010 to 4/15/2010
Santa Clara, Calif.
O'Reilly Media

4/19/2010
New York City
Flagg Management

4/25/2010 to 4/28/2010
Overland Park, Kans.
IIUG