Why I Chose Angular Going Into 2020

Three good reasons

Faisal Choura
Dec 3, 2019 · 3 min read
source: angular.io

In the front end development world, most people will hype React. They’ll say how it can be used for web, desktop, and mobile development, and that a lot of big companies are using it. This makes choosing a different library for your project a bit harder, even though each library has its strengths and weaknesses. I won’t dive into comparing JavaScript frameworks and libraries — there’s an abundance of this sort of thing on the internet. In this piece, I’ll tell you why, after trying Vue and React, I decided to go with Angular.


Angular is Opinionated

I got into web development through learning Ruby on Rails back in 2015. I loved it. I enjoyed many different things in Ruby on Rails — one being how it’s an opinionated framework. For those who don’t know, an opinionated framework is one that has a certain way of doing things, which developers are pushed to follow, at least to an extent.

Some of you may not like the restrictions and would prefer the flexibility and freedom of setting up your project in your own way. If that’s you then you’d have more control over that building your web app in React.

I enjoy this because as soon as you set up your project using the Angular CLI, you get a template engine, a router, form validation, reactive programming RXJS, a guide on how to structure your code and how the data should flow in an application. It also makes it a lot easier for other developers to pick up someone else’s code.


TypeScript

I bet you’ve heard this before: Yes, you can use TypeScript with React and Vue. TypeScript is a strongly typed superset of JavaScript, and Angular is built on it. It comes with it out of the box, so it feels like home. I like TypeScript because it’s a strictly typed language — if types are used properly they make your code easier to understand, manage, and refactor.

For example, by using types you can tell what type of arguments a function takes in and what value it returns directly from the IDE. This saves you the hassle of doing a to figure out what goes where.

The compiler will also pick up any type mismatches that would usually go undetected and only be caught at runtime. Almost every JavaScript developer has been through a debugging process where they had to deal with a type error. There are other ways to tackle this — for example, in React you could use prop types, but it still does not feel as natural as types in TypeScript and Angular.

What’s also a huge plus is that TypeScript offers dependency injection and it’s heavily used in Angular as it lets you inject services and other classes into a component giving that component access to those classes.


RXJS

This is not just an Angular thing, you can add it to any project and use it in more or less the same way. But it comes shipped with Angular and it’s used in their built-in services like the HTTPClient which is the defacto way to make HTTP requests from an Angular app. RXJS gives you a lot of power with minimal code.

Let’s say you make a get request and find out that the format of the response is not what you wanted. Adding an operator like will let you alter the data and return it the way you want. If you then decide to let the returned value have some other modifications you can add another operator easily. And for the times when you can’t find an operator that does what you want it to do you could build your own custom one.

So refactoring or adding extra functionalities to existing code can be made relatively easily. RxJS is also great for state management as you can create an observable and subscribe to it from multiple places — when a change happens to the main observable, it is emitted to all the subscribers.


To Conclude

Angular might be harder to learn than Vue and React, but once you get familiar with it, you have an all in-one-framework that can be used for hybrid mobile/PWA development (with Ionic 4), is supported by Google, has very good documentation, and comes packed with features to tackle your next project.

Better Programming

Advice for programmers.

Faisal Choura

Written by

Credit Suisse full stack developer with a passion for frontend development and UX

Better Programming

Advice for programmers.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade