Is AngularJS killing ASP.NET MVC?

October 3, 2017 | by Rodolfo Ortiz

In App development, developers

The short answer is that, in some sense, yes, AngularJS is killing ASP.NET MVC. But that doesn’t mean you should jump in the AngularJS boat for your next project, which is hard for me to say since I consider myself an AngularJS advocate.

An interesting theme to discuss

For example, the first time I used AngularJS in a project was back in 2013. I chose this technology back then because I had been looking for a way to better organize my JavaScript code, and AngularJS seemed like the best option. After this, my next project was a highly interactive website, with lots of user interaction, and having it behave like a SPA would make the development easier, so I picked AngularJS again. In my current project, I’m still using AngularJS. Now, let’s talk about the reasons why you should not pick AngularJS.

First, not every website has to be a SPA, and therefore, doesn’t need to be built with AngularJS. Yes, I’ll agree there’s a tendency towards building websites as SPAs. However, think about administrative websites which are not very interactive, like an ERP. In my previous project I worked with a medical laboratory administrative website, which was not using AngularJS and it worked fine. It fulfilled the requirements and companies bought the product.

using a little bit of both tools is a great practice

There was no need for AngularJS. Now consider the opposite case, which could be your typical pizza ordering website, where you build your own pizza and pick the toppings. This type of website fits the SPA architecture, and AngularJS is a good fit.

Moreover, consider that AngularJS has a learning curve, and I’ve seen some .NET developers struggle with AngularJS. This is something to think about if you are planning to implement AngularJS in your next project. More specifically, make sure the team is trained correctly if you’re going to use this technology.

Think about it this way: C# is very different from JavaScript. In other words, a .NET developer which is proficient in C# won’t necessarily be proficient in AngularJS. After all, many .NET developers chose .NET because they like compiled languages. And also, because it has an IDE and is strongly typed.

To complement the previous point, the code written in AngularJS can get complex if you don’t plan correctly the JavaScript architecture. AngularJS gives us a lot of flexibility -and JavaScript too-, but not following good practices will make you end up with code that is difficult to maintain and difficult to understand. Or as most developers would say, spaghetti code.

AngularJS gives you tools to use in the form of controllers, modules, directives, templates, services and so on; but they can be misused and your code can potentially become a big ball of mud.

Finally, I’m not saying I’m against JavaScript code. Every website needs some amount of JavaScript code. My main point is that you don’t always need to implement a JavaScript framework to organize your JavaScript code. In some cases, smaller and simpler libraries could get the job done, like Knockout.