Why Learning Angular 2 Was Excruciating

15,282 reads

A few months ago I decided to try my hand at web development. Angular 2 was new and shiny at the moment, so I decided to download it and start building a website. Now, as someone who is primarily a Java developer, this was an altogether new and very interesting experience. I followed the alleged “5 Minute Quick Start Guide” and after an hour and a half of wrangling with Angular 2 and its plethora of dependencies, I was able to get something up and running.

Next, I started to build a real app. I decided to build a personal blog platform from scratch, mostly for the learning, and partially because I’ve been meaning to start a blog for ages. The desire to have a blog would be the carrot keeping me motivated to learn new technologies and keep building my project.

Over the months, I’ve been keeping up with the Angular 2 releases and, each weekend, I’ve been chugging along on the blog. Oh, did I say chugging? I meant banging my head vigorously against the wall over and over and over again trying to understand and deal with the freaking Javascript ecosystem.

Maybe I’m just used to the slow paced, sturdy, battle tested libraries of the Java world. Maybe learning web development starting with Angular 2 is like trying to learn a new video game and starting on hard core mode. I don’t know.

All I know is that the Angular 2 release was, from my perspective as a Java engineer, a freaking disaster. Every single minor release made lots of breaking changes. Every single time I checked back on the accursed “5 Minute Quick Start”, huge swaths of it had completely changed. Don’t even get me started on the whole Angular 2 router business. That was truly a fiasco, and agonizing to deal with as a user, particular one who is less familiar with the Javascript world.

I find myself writing this post in a moment of passion, fuming over the latest Angular release which was announced a few days ago. Angular 2, for rulz this time, has been released and you can upgrade to it and not have to deal with breaking changes for a whopping 6 months! Well then, I naively thought to myself, I should upgrade my blog from @angular 2.0.0-rc.4 to @angular 2.0.0.

This was the journey that I just underwent:

Upgrade to @angular 2.0.0 Remove all ‘directives’ fields from my Components. Apparently Angular2 has decided that Modules are the way to go. Get rid of all imports anywhere that end with _DIRECTIVES. Upgrade @angular/forms from 0.3.0 to 2.0.0. For some reason, @angular/forms was super behind the rest of the versioning for angular. Until this release. Upgrade angular-material to 2.0.0-alpha.8–2 (can we just pause for a second and appreciate the ridiculousness of a version called 2.0.0-alpha.8–2??). Upgrade to typescript 2.o, which, as I was unpleasantly surprised by, is currently in beta. Having finally reached a version of relative stability in Angular, it was dismaying to realize that angular-material, a key tool in my stack, has unstable dependencies that are ahead of Angular 2’s dependencies.

By this point, `npm start` was working. This is where the hard part began, because now I had to deal with tremendously cryptic error messages that have been plaguing me ever since I started learning Angular 2. Such as this one:

After some troubleshooting (by now I’ve gotten okay at debugging System JS’s useless error messages), the issue was caused by this errant line in my systemjs.config.js file:

// No umd for router yet

packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' };

I guess @anguler/router has a umd now. Whatever a umd is………

The next issue I encountered after that was this:

Great, a freaking syntax error from a random file in angular-material. There is no helpful error message, no line numbers. There is precious little to help me figure out what to do next. I don’t know whether to upgrade dependencies, downgrade dependencies, install new dependencies, change the syntax of my tsconfig.js file (which undoubtedly changed when I upgraded to typescript 2.0). I’m lost in a sea of confusion and frustration.

Now, those of you who are seasoned web developers can probably troubleshoot an issue like this fairly easily. That’s not what I’m getting at. It’s not about the particular issue I just faced. It’s that the Javascript ecosystem is utter chaos. Every new version of every new library comes with a slew of breaking changes. New libraries will be released before their APIs are nailed down. Libraries in beta are now old news because only alpha libraries are new and interesting. Stackoverflow posts that are older than 6 weeks old are no longer relevant and probably deal with an issue from an old version that I’m no longer using.

The Java engineer in me is screaming with the frustration of this ecosystem. What sort of madness has web development devolved into? What the f**cking f**ck is going on with Javascript these days???

Okay, I think it’s time to take a step back and say that I actually love Angular 2. When I get to a point where all the dependencies have been upgraded, and everything is working, when Intellij is underlining the correct things and my typescript compiler is hooked up right, Angular 2 is awesome.

To be fair, I have been using versions of the library that have thus far not been officially released. Maybe, you say, it’s my fault for trying to download and use a version of the library that is still in alpha/beta/release candidate and expecting it to work and be relatively easy to use. Perhaps you are right. But, considering the fact that hundreds of thousands of developers are already using Angular 2, we should ask ourselves the question: is it responsible to release libraries that are still very much a work in progress? Does it make sense to announce a release candidate and then make tons and tons of breaking changes over the course of evolving from rc.1 to rc.6? How many hundreds of thousands of human hours were wasted dealing with the pain of upgrading a version of Angular 2 and all of its related dependencies? And, as most engineers will attest to, developer hours are a precious commodity in today’s job market. How many developers have been utterly burned by the experience of trying to use Angular 2 and have sworn off Angular forevermore in favor of React? How many other Javascript libraries are out there that have also caused such frustration and undue anguish for their users?

Perhaps the Javascript ecosystem is just experiencing intense growing pains. Maybe developers are quickly understanding the errors in their initial designs and brazenly correcting them as they blaze on in iterating through better and better versions of their libraries. Maybe the Javascript world is where the vast majority of software engineers will live soon, since the tools there will have evolved rapidly and effectively. Perhaps people will accomplish more in Javascript and the tools written in Javascript will be easier to use than the tools in any other software engineering landscape. Or, maybe, just maybe, the Javascript world will always be sort of a joke, a place where engineering hipsters go to waste time and feel like they’re on the cutting edge of innovation when really, they are living in a world of madness and chaos, throwing hours of productivity down the drain so that they can use the latest and ‘greatest’ tools out there.

But I am just a humble Java engineer. What I’m most interested in is: what do you think?

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMIfamily. We are now accepting submissions and happy to discuss advertising &sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Tags