More in this section
Categories
Bloggers
Blogs RSS feed

MVC: The Preferred Way of Coding in Sitefinity

by Peter Filipov

MVC The Preferred Way of Coding in Sitefinity BlogPost Image

The development and launch of Sitefinity 11.0 has been an exciting process. With the latest release, you may have noticed some changes with the structure of the documentation. The framework, codenamed “Feather,” has been moved and is now substituted with MVC. The new default doc structure is oriented toward the MVC approach compared to the previous version, which was WebForms. Long story short, WebForms and “Feather” switched places in the documentation and now MVC is the default and WebForms is in a separate category.

Additionally, the MVC widgets in the hybrid pages are on top of the toolbox from version 11.0. This is a small but important step in the adoption of Sitefinity MVC. With all that said, our recommendation to all Sitefinity developers is to use MVC whenever possible, especially for new projects.

Why Go in This Direction?

Recently we ran a survey with our Sitefinity developer community and found that MVC is the preferred way of coding in Sitefinity on 100% of new projects. In addition to that data, we had discussions with our partners and they confirmed MVC is their preferred way to develop with Sitefinity. Now, finding MVC documentation is easier—no more looking for codenames like “Feather.” With that minor change in the documentation, we wanted to make things easier for people already using MVC and promote the preferred way of developing with Sitefinity.

If we compare Sitefinity MVC vs. WebForms, there are many advantages in favor of MVC. I don’t want to bore you with all the nitty-gritty details, so here are a few high-level advantages worth mentioning:

  1. MVC is faster, lighter and easier to code with. The model-view-controller pattern brings better maintainability of the codebase e.g. cleaner markup and decoupled architecture.
  2. All the code could be found on GitHub—widgets and core.
  3. It is not necessary to use JustDecompile for the views.
  4. The views of the widgets are part of the resource package in Sitefinity projects and are modifiable.
  5. Usage of the latest frontend technologies, such as Bootstrap, Semantic UI, etc.

Developers could modify the default implementation to fit their scenarios in minutes. Taking advantage of all those things will make your developers much more productive and cut the time to market dramatically.

What Should I Do If I Use Sitefinity WebForms?

The simple answer is to start using MVC—it’s never too late to switch sides! But sometimes it’s not so simple. I see three major challenges that might make switching difficult:

  • You are using WebForms for new and legacy projects because you don’t know MVC and there is a learning curve.
  • You are using WebForms only for legacy projects because you cannot migrate them to MVC.
  • You are using WebForms because you cannot convince your team/company to switch to MVC.

The first step to solve #1 and #3 from this list is to ask yourself whether using MVC will greatly benefit your development and productivity. The answer is “yes, it will” and you shouldn’t wait! The Progress Sitefinity team recommends our customers use MVC instead of WebForms. Now that we’ve convinced you, the next step is to go through the documentation and learn more about it. Here are two great articles to start: MVC capabilities and APIs and Providers.

When it comes to #2, the reality is that it’s really hard to migrate projects from one technology to another. It takes time and money. We perfectly understand this and won’t insist on unreasonable things. Our recommendation here would be to migrate to MVC when sites are still small to midsize because once the project becomes huge, you won’t be able to.

Is Sitefinity WebForms Deprecated?

At this point, I’m sure many of you may have this question in your heads. The answer? No, nope and absolutely not. Our intention is to provide the best solution for Sitefinity developers and give them the right recommendations.

Let me know what you think! I am more than happy to discuss why MVC is superior and why you should use it. 

Leave a comment