Why Angular 2 (4, 5, 6) sucks
Angular team, I would like to thank you for the three years you spent on making the new and shiny Angular 2.0. But your new framework sucks. And I’ll tell you why.
However, there is a very simple principle that I follow in all of my projects. The principle says:
Keep it simple, Stupid.
And that’s exactly where the new Angular has failed in so many ways.
Even though the learning curve for Angular 1.x was not ideal, the framework itself
was something more or less straightforward. It did not require TS, HTML compiler, CLIs, specific structure, webpack, Tree shaking, AOT compilation, and so on.
It just worked.
I was able to insert a bare
angular.min.js in the file and start writing the code right away (even though I still used Gulp to livereload/build the app).
The whole idea behind a good framework is that you start with the simple stuff and make it more complicated only when you want it to be. The Angular team went in a completely opposite way.
Let’s discuss why Angular 2 is overly complicated in details:
1. It is written in Typescript
P.S. I know that I can still kind of use JS with it. But in reality, it becomes close to impossible because I would have to deal with the fact that everything else around Angular is made with TS (like plugins or docs).
2. Angular-made HTML is not a valid HTML anymore
Just think about this next sentence: Angular 2 team had to write a compiler to
compile “Angular HTML” into HTML because some of the tags Angular uses are not
No, that compiler does not make HTML more readable — Jade (aka Pug) does. The only purpose of the compiler is to change Angular tags into something more valid and to (also) add a bunch of garbage into your final HTML.
That's not it. The compiler gives an insanely useless traceroutes, if you ever have an error in HTML, well...good luck finding it. Oh, and should I add, the whole app won’t start until you find that mistake.
3. Angular takes an infinity to hot-reload your code
The thing I love the most about JS apps is that I can change a piece of code and see the results immediately in my browser.
With Angular 2.0, that is not true. Not anymore. I have a very powerful quad-core laptop and it still takes me 3–5 seconds to re-compile an empty Angular app. For already developed apps like ng2-admin, it takes roughly 10–12 seconds. You gotta be kidding me right?
Using our good old Angular 1.0 and a simple Gulp setup, I was able to concat all my code and reload the page in half a second.
The webpack configuration of Angular 2.0 is 300 lines long. It is so big and unreadable they had to make a separate config for a config. Nice, right?
4. Huge size of the initial app
This is something everyone has been moaning about for awhile now. Bare Angular 2.0 (+RxJS) weights around a megabyte. Yes, a megabyte. It is like 6 times more than previous Angular apps and 10 times more than what I expect my users to download over a 3G connection.
Think about it. The initial Angular code was so big and complicated the team had to make it even more complicated just to make the code smaller! In other words, React and old Angular were both small enough that the team didn't have to deal with all these additional optimization techniques.
I can continue to add to the list but I think I’ve made my point.
Angular 2 is not that bad. It is completely modular, follows specific structure, uses types, and (in theory) allows you to write code with less errors.
But in my opinion, things should stay as simple as possible. Angular is far from simple. It just seems overly complicated.
I make web applications, not software for spaceships. The Angular team has introduced so much added (and unnecessary) complexity, which means:
- There are significantly more failure points. With the not-so-helpful traceroutes, Angular 2 becomes a headache that causes developers to waste their precious time.
- It is hard to adjust the framework for specific needs. Developers might start to fight the framework instead of writing the actual code.
- It has an extrememly steep learning curve. Sometimes I work with much less experienced developers — I want them to be able to make changes without going through 200 tutorial videos.
Would I need all these complexities in my small private projects? Ehm, probably
not. In my company’s medium-sized projects? No, I don’t think so. In a big enterprise-sized apps where 10 teams are working on the same app? Yes, maybe all of these complexity/modularity/precompilation would be good things to have. But then again,if these teams decide to use other frameworks, they might not need so many people in the first place
I would be more understanding if it was impossible to make a good and stable webapp without all the complexities. But as we all know, it is possible and evit's a lot easier to make good apps without all the complexities. Just take a look on other frameworks like Aurelia, Vue.js (my current favorite), or on something React-based.
This tutorial was originally posted by the author here. This version has been edited for clarity and may appear different from the original post.