Should I Use Angular 5

Should I Use Angular 5

High level overview of Angular and my thoughts about the pros and cons of using it

2017-12-13

The Question

I am sure that many developers that work with Angular ask themselves -
Should I use Angular for my next project?
Do I want a full trunk framework or should I use one of the newer libraries?
Will Angular be fit for future changes that my app will require?
So I ask myself… Should I use Angular 5?

About Angular

If you have been writing web applications in the past few years, you must have heard about Angular. It’s one of the most popular front end frameworks for creating single page applications. I remember getting to know it a few years ago. back then, I thought there was a strong hype around single page applications, today in my opinion it is the standard to writing modern web applications.
From the Angular website:

“Angular is a platform that makes it easy to build applications with the web. Angular combines declarative templates, dependency injection, end to end tooling, and integrated best practices to solve development challenges. Angular empowers developers to build applications that live on the web, mobile, or the desktop”

Which Version Is It Again?

First things first - it’s not angularjs anymore, why be so formal? it’s just angular. I like it.
Well now it’s version 5, before it was 4 and before it was 2.. Confused? So was I. There are a bunch of articles about it, here is one, and another. Basically, the reason is that they moved to semantic versions, and there was some technical issues with the versioning tool and… it’s actually not that interesting. The important thing to know is that major versions could break your code. for example: if you are using angular 4.1.1 you can safely upgrade to 4.2.0 or to 4.1.9 , but upgrading to 5.x.x can break your code.
I have to say the difference between angular 2 and angular 4 feels huge. the syntax is totally different. In fact you can’t even use JavaScript…

Type-what? Oh… TypeScript…

Just JavaScript is just not enough any more for some people, and I have to say that it does have some advantages. it makes the code a bit more readable, it’s object oriented, cross browser compatible and it has a compiler that compiles the code to JavaScript. The compiler enables you to catch “compile time errors” so it protects you against yourself. it’s kind of like CoffeeScript but not really.
In my opinion, compilation is not very necessary. call me old fashioned but writing a script language that compiles into another script doesn’t make too much sense. I also don’t like TypeScript “forcing” me to do stuff I don’t want.
It’s less flexible than JavaScript, but hey it’s JavaScript after all..
Cross browser compatibility is a real plus.
I guess it’s evolve or die from the angular angle, there’s no plain JavaScript option so use TypeScript. I liked Dan Ward’s break up letter for angular, it makes a lot of sense. angular offers a lot good stuff so I can bear with some TypeScript. I just sometimes wish I could use plain old JavaScript.

Speed

Not performance, speed. Definitely one of the most important things to consider when choosing a framework. Of course check that it suits your needs first, but I guess most of the big ones do.
I think that the angular-cli is just great. it generates whatever you need, it has a web server that reloads your page (which is always nice) and it has environments. Saves you time and gets you up and running in no time. Awesome.

Templates

Angular templating system feels to me more convenient to back end developers. Sure it’s framework specific, so you probably have to work closely with the documentation, but it’s kind of like the templates we all know from twig, or django, or whatever server side template languages out there. The whole component approach offers modularity that’s hard to give up.
Some say that putting JavaScript into HTML is wrong, others say the opposite. Who’s right? well… Who knows?
So in conclusion, whatever is more convenient works. no strong opinion here.

Data

Coding UI properly is hard, it has to be convenient for the user and it has to look good. Most importantly, it must make your app’s data approachable to the user. Angular solves this with two way data binding, which makes life a lot easier. you don’t have to write code to update your UI elements, it happens automatically. In my opinion - a huge plus.

Size Matters

Angular feels bloated. it matters, because the browser has to download all that JavaScript. You can argue that most connections are really fast these days, but what about mobile?
Is Angular really bloated? I guess all that functionality comes with a heavy price, I am not sure I always want to pay it.

Conclusion

My answer is not a conclusive yes or no.
I can’t give up development speed just yet, so in some cases I would still go with Angular. It definitely gets the job done.
I do think it’s time for something new, time to evolve and adopt new approaches.
The truth is - I used to love Angular, but that love is now mostly gone… so for my next project I’ll prefer to use something else. I can’t tell you it’s a technical decision, you might see me use Angular on my next post, but sometimes you have to go with your gut.
Thank you for reading.