"The only constant in life is change," famously stated Heraclitus, and he is still right 2,500 years later. Even if we focus on the relatively stable ASP.NET platform, we can still see a lot of changes over the last few years — a new version of ASP.NET MVC written from scratch, tons of client-side frameworks to consume Web API services and so on.
In this article, we'll go over the four main pillars in ASP.NET development: ASP.NET Core; ASP.NET MVC 5; Angular + Web API; and ASP.NET Web Forms. We'll discuss the use cases where each one is most appropriate. We'll also look at the results of our Telerik's September survey in which 360 developers revealed their ASP.NET technology of choice for the next 12 months.
Ed. note: This post is the first part of a full week dedicated to ASP.NET Core content. Check back every day this week for a new article.
ASP.NET Core is the newest technology for creating ASP.NET applications, opening the doors for Microsoft developers to many platforms and technologies they never had access to before. My colleague Ed Charbeneau discusses all the perks of this new technology in the whitepaper ASP.NET Core Changes Every Developer Should Know, and I would like to pinpoint the ones I consider most significant:
- ASP.NET Core apps can be hosted and developed under Linux, OSX and even BSD! In my opinion, this is the biggest perk of the new platform, making it a game changer for organizations that don't want to be dependent upon the Windows Server ecosystem.
- ASP.NET Core is detached from Visual Studio. You can use the .NET CLI and a text editor of your choice to develop for it. Scaffolding is now available outside of Visual Studio through Yeoman integration. The Yeoman ASP.NET generator already has more than 10K downloads per month.
- It's now easier to write Web API endpoints because it uses the same controller syntax as MVC.
- Consider ASP.NET Core for performance-critical apps:
We asked developers, "Which .NET technology will you primarily use to develop new web projects in the next 12 months?" 12% of those surveyed replied they'd use ASP.NET Core. That's a relatively small portion, but is 100% growth compared to developers who said they used the same technology for new project development in the past 12 months. What's more, when we look at what developers said in the survey we ran in March and the one we ran in September, it seems that the intent for adoption of ASP.NET Core is growing and is stealing share from the Web API + Angular option.
[inlinetweet]12% of ASPNET devs plan to use ASP .NET Core for new project development in the next 12 months.[/inlinetweet]
Use ASP.NET Core if you can afford spending a bit more time on R&D and dealing with the early adopter problems. The benefits: being able to deploy on OS of your choice and better raw performance.
[inlinetweet]Use ASPNET Core to get x-platform deployment & better performance if u can afford the R&D time & handle early adopter problems[/inlinetweet]
Despite the early stage of the technology, there's some tooling already available to help you build apps more quickly. If you prefer not to spend time writing UI from scratch, take a look at Telerik UI for ASP.NET Core.
ASP.NET MVC 5
ASP.NET MVC 5 is now in a mature state, providing the reliability and stability in case you don't want to deal with the early adopter issues that may arise from using ASP.NET Core.
The biggest selling point, in my opinion, is the wide variety of third-party packages and productivity tooling to choose from and the active community around them. For example, I recently had to troubleshoot a memory leak in ASP.NET MVC application and my first step was to use the static code analysis to detect any obvious bad practices (like not properly disposing data streams). As of the time of writing this, the same kind of tooling for ASP.NET Core is still in development.
ASP.NET MVC 5 seems to be the most popular framework with 34% of respondents planning on using it for new project development in the next 12 months. However, with early adopters moving to newer technologies, intended usage in the next 12 months drops 13% compared to usage in the previous 12 months.
Use ASP.NET MVC 5 if you want a stable and proven platform for your next application. You will probably have faster time to market compared to boththe ASP.NET Core and the Web API/Angular approach thanks to the tons of available scaffolds, project generators and online help resources.
Also take a look at Telerik UI for ASP.NET MVC if you prefer not to spend time writing the UI from scratch.
[inlinetweet]Use ASPNET MVC 5 if you need a stable platform enabling fast time-to-market +tons of available scaffolds & project generators[/inlinetweet]
ASP.NET Web API + Angular
Decoupling the backend from the frontend is one of the fundamental good practices for sustainable and easy to maintain application development.
The idea in this particular scenario is to have a dedicated Web API backend that serves and manipulates your business objects (i.e. models) and transports them using HTTP(2) to the client to be fed to a single-page application. A year ago, a common choice for this framework would have been AngularJS but, today, you may seriously consider going with Angular 2 instead. In both cases, the backend stays the same — leveraging the power of Web API and Entity Framework. I suggest taking a look at this excellent blog post by Ed Charbeneau for tips on getting started with ASP.NET Core and Angular.
The interesting combination of ASP.NET Web API (either Core or 5) and Angular front-end is the preferred technology for the next 12 months of 13% percent of developers surveyed, up 31% compared to the usage in the past 12 months.
Use ASP.NET Web API and Angular when you want to have strict separation between the frontend development and the backend business logic.
If you choose ASP.NET Web API + Angular, you can save time developing the UI using Kendo UI for AngularJS apps and our newest UI suite for Angular 2: Kendo UI for Angular 2.
ASP.NET Web Forms
ASP.NET Web Forms is the most mature of all frameworks discussed here, and, with the recent additions of Roslyn compiler support and HTTP2, it is not lagging behind the innovations that happen in the other platforms.
In fact, the stability of the platform, the speed and ease of drag-and-drop development, the large pool of developers familiar with it, as well as the support for the latest ASP.NET-wide features help keep the usage at considerably high levels.
Another thing to consider is the availability of very rich and mature components framework. For example, Telerik UI for ASP.NET AJAX contains more than 100 components covering a variety of verticals. From PivotGrid with OLAP support to rich DataViz to always used Grid and Form elements, ASP.NET WebForms won't disappoint you.
18% of developers surveyed will use ASP.NET WebForms for new project development in the next 12 months. Despite the fact that this is down 5% compared to usage in the past 12 months, WebForms comes second after ASP.NET MVC5 for new project development in 2017.
[inlinetweet]18% of ASPNET devs surveyed plan to use WebForms for new project development in the next 12 months.[/inlinetweet]
Use ASP.NET Web Forms for fast time-to-market and real rapid application development. The content served to the client will be much bigger than the when using MVC, however for intranet apps this is not really an issue. Also consider WebForms if you are a desktop developer looking to start doing web development—transition will be easiest.
At the end of the day, what should you use for your next project?
As you can see there's no one-size-fits-all-answer to choosing the ASP.NET technology for your new project development. It all depends on how you rank the importance of different decision factors like the application's performance, time to market, leveraging you and your team's existing skills, control over the code produced, choice of server ecosystem, choice of IDE, as well as availability of third-party productivity tools.
If you're interested in a deep dive of these technology options, feel free to watch the recording of our webinar Choosing the Right Tech Stack for Your ASP.NET App. Another cool resource on the topic is this article onNon-Tech Factors to Consider When Choosing Your Tech Stack.