I still remember the time when I started doing what I would call “legit” or “professional” programming when I got my first internship as a Software Developer. In fact, that was the only internship I had in my programming career, which makes me wonder whether it is really necessary to have multiple internships before you land your full time job as a programmer.
Anyways…
… during my internship, I got the opportunity to work with .NET frameworks. If you are a .NET developer, or used to work with .NET frameworks you probably remember learning about the Model-View-Controller (MVC) design Pattern. If you didn’t even hear about this concept during your .NET times, then something is wrong with you.
Not really, but sure thing it makes me wonder if you were really using any .NET framework.
When I started my career, I thought .NET frameworks were one of the main frameworks along with C# to program web applications. However, my excitement quickly vanished when I realized that was the main framework used in the local community. After about a year of learning and working with .NET frameworks, I quickly realized that was a problem. That was a problem because I was gaining the skillset that could help me boost my career in my local community, but not outside of it.
Don’t get me wrong, there could be a ton of places outside my community where I could use my .NET skillset. However, for some reason, I always felt there weren’t many of them. Therefore, I started my journey of learning a new framework. During those days I often heard about Angular and React, and the increase movement of learning a frontend framework (React is a library though, but there are frameworks built for React).
Without much reasoning or much research, I went ahead and decided to learn a frontend framework. This is exactly what I did one day: I opened Udemy, I found the most popular Angular courses in Udemy, I got my credit card, and all of the sudden I had completed my self-investment in becoming a better programmer by purchasing about 3 online courses I didn’t know if I was going to really enjoy or not. Do you think I am messing around? Below is the proof my friend.
Te lo dije!
Wait, this is a programming blog in English. I meant to say I told you! I wasn’t lying to you. It’s time to put extra credibility in this blog. By the way, don’t be fooled by the year in the title of the course. Instructors usually update the title of these courses every year.
Back to the topic.
I first learned Angular for about 2 months. Well, I went through the course material in about a month or so and I even decided to create my personal website using the MEAN stack. I’m not going to lie, it was a little bit of a challenge at the beginning. One of the main challenges was to make proper decisions with regards to how far you can split your components and make them reusable as much as possible. One factor was my website didn’t have that many sections that could be reused in several pages. Therefore, I pretty much treated each page as a component. I was still thinking the MVC way. Although you could have as many Views and View Templates, the Views were too large. The Views oftentimes meant one page of the app being developed. Splitting components seems to be a simple concept to understand but hard to implement when you are brand new to using a framework.
Luckily for me, the company I worked for was in the transition phase to use new technologies as well. In fact, they were planning to use Angular for new projects, especially for smaller projects. The smaller the project, the higher the chance to put into practice new frameworks such as Angular, and we got a few of those kind of projects on our plate. Therefore, I was able to put into practice everything I had learned during my online course. As usual, the more practice the better you become at using one technology. Building forms was becoming a quick process, creating services to store API request methods was easier to understand, using pipes to transform the output of the data, etc.
After 6 months of learning and practicing Angular, I thought I knew it all about Angular. In reality, I still needed to understand more advanced concepts of the framework. However, it was that time when React was becoming popular as well. It was the time when I was hearing React was better than Angular, and many companies were using it as their frontend framework of choice.
Like a good unexperienced junior developer a few years ago, I believe in 2018, I had decided to learn React because that was what everyone seemed to be using, or actually, everyone out of my local community (I still think the same way). For some reason, learning React was more challenging for me to learn at that time. The JSX syntax was different and at the same time I didn’t like it. I gave React a try for a few weeks, but the light bulb didn’t want to turn on in my head. Therefore, I quickly stopped learning React.
Now with more expertise in Angular, I still hear a lot of developers talking highly about React. I decided to learn React for the second time not too long ago. This time not because many were saying that is the cool thing to use, but more for the sake of learning it. In fact, I created another blog post called Learning React as an Angular Developer talking about my experience learning React and touching the differences and similarities between Angular and React.
I know, I know, you only want to know the reasons why .NET developers prefer Angular over React. However, it is important for you to have knowledge on my experience, and how that could relate to you if you are or used to be a .NET developer. Without further ado here are the top reasons:
Table of Contents
1. Strongly Typed Safety
This is probably, if not the most important reason among the top, why .NET Developers pick Angular over React. Think about it: .NET Developers generally use C#. According to the gods of programming languages, C# is a strongly typed language. That means if you are trying to pass a numeric parameter to a function that expects a string parameter, it will throw a nice error at compilation time. This is exactly what happens with Angular. Since Angular comes by default with Typescript, it forces you to define a type to every variable, property, or method. In that way, you feel your C# experience is not completely gone.
If you are going to say React can have the option to use TypesScript, that’s correct. However, hold tight there first. You just said it. It is optional. Instead it is required in Angular. Also, if you go over React’s tutorial you will find they mainly go through the concepts in plain vanilla JavaScript.
2. HTML in the HTML file over JXS
Defining a template within a JS file must be the selling or hating point about React. That’s right. You will find React developers finding this concept very enjoyable. However, if you are a .NET Developer there’s a high chance you are not going to like it, but rather find it confusing.
I’m telling you this because I attempted to learn React and having the template inside the JS file felt wrong and ugly. It’s like defining a controller method that returns a view template in .NET, but the view template is a long string defined in the template and not in a separate file.
I must admit that once you go over writing HTML inside a JS file several times, you will quickly forget about that, and instead you will get used to it, which is exactly what happened to me the second time I successfully attempted to learn React.
Angular in that aspect feels more like .NET. There are HTML files for each component avoiding the feeling of mixing HTML with JavaScript in one single file. You will feel the logic should remain in the mycomponent.ts file and the template in the mycomponent.html file, and in a similar way, this is done with the Views and Controllers using the MVC pattern.
3. Framework Feeling
Before you start saying there are frameworks built on top of React such as Gatsby or Next.js, you must acknowledge that it doesn’t come out of the box like the way Angular is built. With Angular you know you are dealing with a framework right away.
You start learning Angular’s concepts on an Angular’s framework from day one if you decide or decided to learn this frontend framework. I can guarantee you that many .NET Developers started learning C# or VB.NET while learning the .NET frameworks available.
Also, Angular offers several built-in libraries similar to .NET, limiting the usage of third-party libraries and allowing ready-to-work integrations without fearing whether or not it will be compatible with the framework.
4. Large Projects
It feels most large projects, which you can find in the medical industry or government-related projects, have or have had some type of development done using .NET framework for the backend. In a similar way, Angular is widely used among the same line of projects. Oftentimes finding Angular as the frontend while a .NET being the backend. One of the reasons this happens is because Angular has a universal way to develop UI using that framework.
There’s a pattern you almost tend to find in any Angular project. You know Angular services are mainly used to make requests. You know there is a feature to lazy load new pages into your Angular page, and there’s no other way around it. You know you will have a shared folder, a services folder, a components folder, or a models folder 99% if you join an Angular project. That exactly goes along the same lines with .NET development, there is a models, views, and controllers folder structure.
Having a defined way to do things makes it easy to standardize development across multiple microservices, which are often found on large projects. This makes any developer from any team able to jump into several different Angular microservices as the learning curve to follow development patterns becomes almost null.
5. Corporate Feeling
I haven’t heard of a startup or Facebook, Amazon, Apple, Netflix, or Google (FAANG) to use .NET as the main development framework. Although it is understandable that FAANG companies don’t use it as they often build their own frameworks such as Google with Angular, and Facebook with React, you would think the name of Microsoft should provide a good reputation to develop these applications using .NET.
In a similar fashion, if you start googling for job opportunities, it seems every company uses React. Yes, I know there are plenty of Angular jobs out there, but React takes the lead in this aspect. Whenever you start finding companies using Angular, you will come across, besides Google of course, government projects, corporate banking, or medical industry related companies. All of them are industries that have been here for a long time, and there is no time soon they will go away. If you start checking the companies using React, you can still find corporate names there, but you will see many innovation and startup companies using React as their frontend of choice.
All in all, those were my top 5 reasons why .NET developers prefer using Angular as their frontend framework of choice over React. You may not feel that some of these reasons have as strong of an argument as others, but after coming from the .NET world and the struggles I faced while learning the two frontend frameworks and my experience, I know you will find Angular more compelling than React, even if it is supposed to be more complex to learn according to many developers out there.