- Flexibility and the opinionated factor
- The Infamous Learning Curve
- The Effects of the Open Source Community
- Debugging Ability
Please let me know what you think in the comments below.
I recently spent 6 months on a team implementing a very intense project using backbone.js (and marionette.js) to create a very elaborate gaming market place. It involved many of the challenges that a typical backbone project entails such as endless sub-views, animation, and handling click happy user events (gamers need to settle down.) And now I have spent the last few weeks building sample projects using BackBones greatest rival: angular. In doing so, I have become quite fascinated with vast differences in the cultures of the two communities. So in order to articulate my own take on the choice between the two, I would like to suggest a new analogy for those less familiar with both:
BackBone is to early LAMP as Angular is to (rather) early J2EE
If you have been writing web apps for many years so that to you remember what it is like to develop the early Perl/PHP CGI scripts of say ~1997-2002, that will help. But for those not from the web stone age, please let me explain.
Flexibility and/or Self-imposed Chaos
In the beginning, the libraries for Perl and PHP in this era gave you tools so that you could access the HTTP headers and send the appropriate responses, but to say they were opinionated would be the farthest from the truth. They were exteeeeeeemely flexible so that you were able to shoot yourself in the foot on an almost hourly basis, thereby making giving your boss (Wad up Tannaz!) a reasonable effort estimate almost impossible.Similarly, I argue that backbone gives you some solid guidance, but the fact is you can usurp that guidance at any moment with very little effort. Meanwhile in Angular, with its system of dependency injection, the strict system of scoping, and the separation of services, the paradigm encourages you to think through all forms of abstraction. So unlike Backbone, this does “force” you into some solid patterns and practices that will help you avoid chaos.
Back to my analogy, PHP (especially then – not so much now) and Perl also let you do almost anything you wanted even though you should show self-respect and follow SOME proper coding practices (can you say, “code interpolated from variables?[1] “). So having angular encourage or even force more structure is a lot like what J2EE did for web applications ~2002.
Learning curve
During my IBM internship in 1997, one of the countless Cal Poly alums (SLOTown!) handed me a book and I just started (horribly) cranking on my first Perl CGI script (OW, my foot!). Meanwhile, learning Java by itself just from a book [2] was not easy, let alone learning J2EE. Even in 2002, you really did need to learn a huge chunk of the API just to get by but there was no such list for early LAMP. So admittedly, I utilized two company sponsored classes back in 2002 just to get my first “promotion” into the J2EE team. This is also a very common criticism of Angular, that it will take a lot more effort to learn because it is much more involved offering.Open Source vs Controlled by the GOOGs
Another similarity here is that ten+ years ago the open source community seemed to strongly prefer the LAMP world to J2EE. This is probably because it came first and possibly also because Sun Microsystems wisely kept the underlying standard of J2EE under tight control through-out its history because, apparently, they did intend to make money off of it (I never completely understood how). In contrast, PHP was graciously given over to the open source community by its brilliant creator (Rasmus Lerdorf) very early and this is probably another reason the open source community has built so many frameworks, CMSs, shopping carts, and countless other forms of reusable tools with it. Similarly, proponents of the BackBone world promote the long list of plugins and extensions available as reason for its superiority. Meanwhile, the list of reusable components written in angular might never match the backbone list due to the differences in history and culture of the two communities.Debugging
For reasons related to the above, I also see a similarity in debugging. Many argue that Backbone projects are easier to debug because it is much easier to trace or console dump the un-minified backbone code itself. You are free to do this in angular as well, but a common criticism is that the declarative nature of angular’s directives (markers on a DOM element) make this a much greater challenge. My memory is that diving through all the open source code in LAMP is much easier than, say, diving through the supporting code of JSPs. Also, I recall one of the great discoveries of switching over to the Java world was that the official error messages were so much more helpful. I should not speak for the LAMP world over the past ten+ years, but I will declare that Backbone’s error messages are often terrible. If they tell you anything at all, the information is rarely useful. Meanwhile, I am adding powerful error messages to the list of reasons that I am grateful to the Angular team at Google. It’s like these people have been on the app-building side of this equation before. Crazy!Conclusion
To sum up, the backbone and angular communities have some cultural contrasts similar to many other long standing debates in the application development communities. Primarily: How much control does the developer want OR how opinionated do you want your framework to be? I completely respect the developer that wants to feel a sense of invention and hates the idea of having to work around a paradigm that is restricting his or her creativity. If that is your primary driver in being a developer, than please take from this analogy that you probably belong with the freedom crew and backbone. I myself hope to still be a part of that crewe from time to time. However, from almost my very first angular project, I was astounded as to how much I did not have to build on my own. Angular, like J2EE years ago, just covers so much of the boilerplate code for me. Meanwhile, during my backbone project, we were constantly re-factoring our code. So if you choose angular, in many cases you will quite simply get a whole lot more done.[1] Ok Javascript can do that too but why? Really. Why?
[2] Yup actually, I am that old. I was the last semester at Cal to learn Data Structures with C++. Wow. Someone buy me a cane . . .
[3] But as I mention in my fist post, I encourage you to use a backbone framework (especially Derick Bailey's Marionette or possibly thorax by WalmartLabs).
[4] Pls see my first post for why Backbone is not a framework by itself
No comments:
Post a Comment