Wednesday, October 29, 2014

RIP AngularJS! Oh Sorry, RIP $scope, ng-controller, DDO, jqLite and whatever you like in AngularJS

I am  Software Developer, specifically Java Developer, spending most of the time writing back-end part of the applications. I can write basic HTML/JavaScript/CSS stuff to get the things done when needed. I didn't have much passion on HTML/JavaScript and neither I am good at web development. I just has good enough knowledge to get the front-end work done for my requirements. Whenever I find sometime I tried to experiment with some cool back-end technologies like SpringBoot or JavaEE7, I never spend my weekends learning any front-end technologies.

When I had to develop UI for my projects I preferred PrimeFaces or SpringMVC/Bootstrap and get it done. But this situation got changed when I found AngularJS!!

Once I started learning and doing AngularJS stuff, I feel its a lot of fun doing front-end development too. AngularJS made so many things easy to build front-end UI such as templating, routing, Ajax etc. I started reading and experimenting with AngularJS on weekends too. I bought couple of AngularJS books and started tinkering with IONIC framework(which depends on AngularJS) too for Mobile Development. Everything about AngularJS is looking great.

Last night I saw ng-europe conference videos on YouTube and I was shocked by seeing their AngularJS 2.0 plans. The bottom line of AngularJS 2.0 is "They are going to kill everything that I learned and familiar with like $scope, controllers, jqLite etc" and introducing "annotation madness" and borrowing features from Dart/TypeScript/AtScript whatever.

Simply put the relationship between AngularJS 1.0 to AngularJS 2.0 is same as Struts 1.0 to Struts 2.0. They are sharing the same name for branding purpose, except that everything looks different.

Let us take a step back and see what is good and what is bad in AngularJS 2.0 direction.

Adaptability:
I feel one of the reasons for AngularJS popularity is, it is easy to learn and use even for back-end developers. I am not feeling the same excitement after looking at AngularJS 2.0 annotated classes, cryptic attributes like (click)="doSomething()".

As a Java Developer my primary interest is in back-end stuff and I just need a tool to get the front-end stuff done without delving too much into HTML/JavaScript world and I find AngularJS 1.x is really great for my kind of people.

Now with this 2.0 changes for adopting next generation ECMAScript/Dart/AtScript/Whatever features, AngularJS is not seems easy to me like it used to be.

Ecosystem:
One best part of AngularJS is you can find hell lot of information in blogs, YouTube, books etc. Just search for AngularJS tutorials, I am sure you will get piles of blogs and videos showing how to developing end to end applications using AngularJS.

Many people invested so much time in learning AngularJS way of doing things, blogged about it. Many books published on AngularJS and many more books are on the way.

With the AngularJS 2.0 direction, all of this knowledge become legacy. Do you buy and read an AngularJS 1.x book which is going to become legacy content soon??!!

Lot of developers spend so much time and build open-source modules and published on www.ngmodules.org. What will be the future of these modules?? What the module authors should do now? Should they continue adding more features for a dead end project? Should they take a break and wait for 2.0 release and rewrite their whole module as per 2.0 way of doing things??

Developer Tools:
NetBeans/Intellij/Eclipse IDE developers might have spent good amount of time for adding support for AngularJS. Now they have to write another set of plugin(s) for AngularJS 2.0 support!! What about Yeoman angular-generator and jHipster??!!

Future of applications recently ported to AngularJS:
Many of the enthusiastic developers learned and loved AngularJS and convinced their managers to use AngularJS for their next big project. Even worse, you might have recently migrated one of your legacy project to AngularJS. What will be the future of these kind of applications? Should we again rewrite whole application using AngularJS 2.0 or stick to AngularJS 1.3 forever??

Consider my scenario.
We have an internal application with a small set of futures which is developed using Java/Spring/jQuery. We have plans to add lot of other features to this application. I spent lot of time convincing my fellow developers that AngularJS is better and get them out of their "jQuery comfort zone".

After I showed few demos and explained a bunch of AngularJS features, my manager and team agreed to go with SpringBoot and AngularJS. Now how do I break this news to my manager and team? Should I go back and say "Whatever I explained you about AngularJS is going to be changed completely and I don't know how it will be in AngularJS 2.0"?.


OMG, I am complaining a lot!! I know it's open-source world. If you like it use it, otherwise move on. Some people even argue you can fork it and continue on AngularJS 1.x branch and we all know where that argument leads to.

Don't get me wrong. I am not saying frameworks/libraries should not be evolved. For a major version a framework can break compatibility to some extent, but not to an extent where you just have to rewrite everything.


Conclusion:
AngularJS 1.x was great. But even before my organization's evaluation cycle completes you broke the compatibility rule. I can't confidently suggest AngularJS for my future project anymore.

On the bright side, AngularJS 2.0 might be a better framework than AngularJS 1.x if you look at it as a brand new framework (who knows!!). Hope AngularJS 2.0 will be great!!.

6 comments:

  1. I prefer GWT and have been through a number of upgrades of both the compiler and the libraries I have used. Because of the strong typing (like an good language should be) its always been pretty painless. Javascript is a hack move to a real language and leave it to be the machine code of the browser.

    ReplyDelete
    Replies
    1. @Mark Miller, what do you do for your automated tests with GWT?

      Delete
    2. Interesting that AngularJS was developed by Java/GWT developers at Google who felt there had to be a better way to develop client-side apps?

      I always felt that writing Java/Swing like code to be transpiled into Javascript seemed like a hack.

      Javascript is a really cute language that is powering the web, both on the client, and the server-side, with NodeJS. As a Java developer of more than 15 years, right now i'm enjoying NodeJS development more than Java, and AngularJS UI development more than Swing.

      Delete
  2. After finishing your article, I realize decide using GWT is the right decision. Compatibility and strong type of GWT is one of key benefits of Java. Since GWT is fully OOP, I can reuse and extend most of my libraries and framework.

    ReplyDelete
  3. I recently discovered Meteor.js, which is a web development ecosystem worth checking out. It has been compared to Angular and seems to be superior in many ways.

    ReplyDelete
  4. I don't think anything changes insomuch as AngularJS 2.0 is not backwards compatible and basically a different framework, and so AngularJS 1.x will continue to be supported, and used by many projects for many years.

    The web is evolving with Web Components and ES6, so that while AngularJS 1.x is ES5 framework, it's natural that the future frameworks will be different to leverage Web Components and ES6.

    I think AtScript looks exciting and i look forward to development of future sites in Angular2 and AtScript, while continuing to support current sites in Angular 1.x, or even migrating them to Angular2 in future.

    It's normal for different projects to be built on different libraries and frameworks for their time. The same way that we were using jQuery in 2012, using Angular1 in 2014, and in 2016 using Angular2. Especially since the web javascript client-side is evolving very quickly, in terms of the VM, language and libraries!

    As to changing from jQuery to AngularJS 1.x now, yes that is still a very good idea to improve your productivity. Use the argument that while Angular2 is quite different, it is designed for the future web, but nevertheless Angular1 will always be supported, and is the most popular choice for client-side right now.

    Alternatively consider Ember and Knockout.

    ReplyDelete