Have you ever asked yourself, why ASP.NET WebForms is not replaced by ASP.NET MVC? Or are you just waiting for the next SharePoint version to support ASP.NET MVC? Or, perhaps you inpatiently tried to integrate ASP.NET MVC to SharePoint yourself? If yes, read on, I might just have what you are looking for.
Let me give you the bad news first (arguable bad), Microsoft is not positioned to replace ASP.NET WebForms with ASP.NET MVC. Let’s just get that once and for all. SharePoint is heavily integrated with ASP.NET WebForms, going back and rebuilding SharePoint with ASP.NET MVC would be a wrong move because it would take so much time with no business value in return. ASP.NET WebForms is working great for SharePoint, and Microsoft would actually continue to promote both paradigm hand-in-hand. SharePoint Developers especially dealing with farm solutions involving Visual Web Parts and Application Pages would continue to use ASP.NET WebForms. In fact, SharePoint 13 is still using ASP.NET WebForms (4.0).
I am not going to compare and contrast the two paradigm, otherwise will spend all day arguing (Dino Esposito, has a great article just on that here). But for the sake of making a point, let me list few good stuff:
ASP .NET MVC:
- Separation of Concerns (SoC) that you get from the upfront division of your application into loosely-coupled components
- Embracement of HTML and HTTP giving you more rendering control
- And of course the testability of your code without spinning the whole ASP.NET runtime
- The event-driven programming model
- A higher level of abstraction
- Very mature 3rd party tools (my favorite is Telerik ASP.NET AJAX)
Guest what? nothing stops you from bringing all 3 bullets listed under ASP.NET MVC to ASP.NET WebForms. It’s just difficult! To bring in SoC, you have to design your application with discipline from the ground-up with Object-Oriented principles in mind. After all, MVC is not a technology, it’s a conceptual presentation design pattern that existed since the late 70s, and evolved from a classic MVC model to MVP, MVVM (or PM) and others, and the pattern can be applied at any level of abstraction or technology (you can even apply it in your daily life). And, of course with SoC, testability would be apparent. Point making the MVC pattern is not owned by ASP.NET MVC.
ASP.NET WebForms does not give you guidely into how to structure your application or where to put your business logic. But it gives you a lot of power, and like my Ruby on Rails professor would say “With great power comes great lack of Separation of Concerns”.
So, how do we close the gap for my dearest SharePoint and ASP.NET WebForm Developers?
Juicy Presentation Pattern! JUIPP in short is a set of libraries and tools that promote convention over configuration to ASP.NET WebForms. Convention over Configuration (CoC) is a common design philosophy where you favor to follow conventions over explicit application configuration. When you use JUIPP, you abide to specific rules governed by naming conventions, well-defined file structure, clear communication mechanisms and component responsibilities. When correctly following the rules, JUIPP helps you focus on the unconventional part of your application and enables you to maintain your application in a consistent manner.
The goal of the Juicy Presentation Pattern project is to have an open source community that would gradually inject Separation of Concerns (SoC), favor Convention-over-Configuration (CoC) for consistent and maintainable application, and emphasize modularization for easier Test-Driven Development (TDD) for ASP.NET WebForms, therefore for SharePoint Visual Web Parts and Application Pages (_layouts pages).
To download the framework and get more information please visit www.juipp.org. As it is a work in progress, any comment or suggestion is very much appreciated.