My JavaScript book is out! Don't miss the opportunity to upgrade your beginner or average dev skills.

Friday, July 10, 2009

Frameworks: To Choose Or Not To Choose

Few days ago the BBC announced the release of their framework called Glow.
John Resig commented this event in a "logical and reasonable way" but instantly different developers reacted over his thoughts.
What John says, in few words, is that BBC developers used jQuery before and they were partially happy with it.
Rather than help jQuery community to grow up, opening tickets, adding patches, or forking the library itself improving it adding Safari 1.3 support, a 0% market share browser that in my opinion is used only inside BBC labs and nowhere else, they decided to spend about 2 years to create a library that apparently does not bring anything new, and which is even more supported by some obsolete or deprecated browser, rather than latest one (Chrome 1 or 2, Opera 10, or Firefox 3.5). This post is about what I think after almost 10 years of Web development experience, where I have used both frameworks and I wrote some for internal purpose. Cases are different for each situation, requirements are different as well as different could be time to create or complete a project.

About Library Browsers Support

Dear net surfers, there is nothing to do, if you need internet, if your business is partially based on internet, if you want everything internet has to offer, you must be updated! That's the story, and this is that simple.
There is not a single valid excuse to be stuck in the past, and if some application in your company works only in IE6, first of all you should consider to upgrade that application, it's deprecated, secondly you should consider alternatives at least for new Web services, that in the best case scenario will suggest you to upgrade while in the worst one will simply do NOT work and you, minority, will just miss that train!

As everybody knows technologies quickly evolves and if you walk down the street with a Walkman rather than an iPod like device, you are mentally 80 years old, retired, and you are missing infinity possibilities, starting from more than an album and hours of music.

Internet, the Web, the Web business, and everything around it, is drastically changing day after day.
Reasons are different, starting from an initial and general misunderstanding about same Web standards and related logics, goals, and behaviors, ending with a revolution that thanks to new technologies, programming languages, and companies, where Google is one of the most important leaders, are acting on daily basis.

In few words: are you a net surfer? Do you need internet? You are probably already upgraded, thanks to be patience and to read this post 'till the end.

Are you someone that does NOT know internet, what it has to offer, does not need it for your business, and surfs the Web few minutes per month?
Do not complain then if the rest of the world that needs internet is moving on in the meanwhile, thank you!

Are you a company that understood only recently the power of the web? If you do not upgrade your browser your business will be decades behind others!

Is IE6 there because of "security bla bla bla"? IE6 is one of the most bugged and vulnerable browsers in the history, fire your system administrator and move on with the rest of the world!

All this effort is just to let you understand that modern web libraries are doing their best to be as much compatible as possible.
Unfortunately, some old browser cannot physically solve "nowadays Web problems" because these browsers have been programmed when internet was nothing more than a "advertisement coupon", with flashing images, providing zero services.

Just consider that an iPhone or a G1, mobile devices, integrate a better browser than IE6 or Safari 1.3 ... is it time to move forward? IE8 is there, as Firefox, Chrome, Safari and Opera are. You have choices, and mainly for free, to avoid to collapse with deprecated services and applications.

So, are you spending money for a Jurassic business, internet time speaking? If yes, why are you wasting money with a browser such Safari 1.3, 98% useless for every recent website, or IE6, forced to be somehow compatible but for its own limits obviously deprecated for modern businesses and applications?

As summary, I do not understand why on earth BBC needs to support people that do not use internet. It could make sense to still support IE6, right now below IE8, market share speaking, but unfortunately still there thanks to people ignorance. But a browser that could be compared with Internet Explorer for Mac, abandoned by Microsoft itself years ago, cannot be a good excuse to avoid libraries ... I simply cannot believe this reason and I would like to have real stats about Safari 1.3 usage in their website.

About Choosing Libraries Or Frameworks

There are hundreds of valid choices out there but this case is mainly about the decision to avoid jQuery.
A good library as jQuery is, if I am not wrong the most used one right now and recently adopted in Wikipedia pages as well, has basically these pro:

  • widely cross-browser supported, more market share than Glow or other home made libraries

  • day after day improvements, bug fixes, speed ups, thanks to an active community, a tickets system and again, thanks to its wide adoption from biggest to smallest website, which can only hep to improve jQuery stability and/or features

  • constant cross-browser tests, which aim is to guarantee stability and functionality over any kind of customer, client, administrator, or simply net surfer

These are not jQuery specific features, these are simply the reason developers prefer to use a well known library rather than an home made one.
Less effort, most of what we need is there, and jQuery is truly reach about plug-ins, so what is not there has been probably already implemented. Charts? Timeline stuff? Widgets? Fields helpers? Almost everything, and it simply works thanks to the core library and its stability, jQuery again.
Just to be honest, I do not even use jQuery except when I need it for compatibility or time reasons, so please do not get me wrong, I am not a fanatic, I read Ext JS, dojo, YUI, and other libraries authors or mailing lists as well so this is just an impartial point of view about libraries and nothing else but, there is always a but, I can understand as well the other point of view ...

About Creating Your Own Library

If we understand the reason a library or a framework is a good choice, whatever programming language we are talking about, even if latter one is created via JavaScript, the most problematic programming language ever due to its intrinsic unstable or different nature (not just one virtual machine but lots of different interpreters, few strictly standard behaviors, thousands of browsers implementation bugs or standards misunderstanding, zero compilation, etc etc) there could be an absolutely valid reason to decide to create our own libraries.
First of all, if we do not want to be "monkeys" but developers, the only way we have to deeply learn a programming language and its problems is to use it as much as possible, without stopping a single day to learn more about it.
If a library/framework does magically everything and we are not curious enough to understand how this library is solving or implementing our daily problems or features, we have probably chose the wrong job, unless we are not designers with different goals, where a library is "just what we were looking for" to quickly solve "that problem" which was not Photoshop related.
Sometimes, we could be simply not interested about the language itself, thanks to frameworks able to translate some "serious language" a la Java or C# into the blamed one: JavaScript (and to be honest I can't wait to laugh about some JavaScript related problem not considered by that framework, who you gonna call: Ghost Busters?!)
Another important fact to consider is the time, never enough in this "everybody agile" web era where if at least the business client core functionality and its tests are delegated to someone else, we are half way through our application goals.
But how different are things if we are plenty of time to develop our own library?

  • we are not necessarily reinventing the wheel, if we are skilled enough, and we have studied problems, features, and adopted solutions, we could simply create something new or just perfect for what we need (as example, the dollar function "is prototype stuff", what jQuery did with it was simply different, but I am sure John will agree about this innovation or "just what we need" point)

  • we will have full control over releases and source code, being able to solve problems in a bit and without dependencies over third parts libraries. We all know that even if have skills to quickly change a library core feature, this library next release could probably mess up our internal patch, or vice versa, and sometimes our case is so particular or simply impossible to reproduce outside our business box, that a ticket could not make sense at all. I personally changed some library core function, or overwritten some core method, and simply because of problems and situations impossible to reproduce into the ticket system. The reason is simple: when the application is complex enough, and it is an internal one (admin areas anybody?), we cannot spend a day to create a ticket which emulates somehow our specific problem. Got the point?

  • the final silly point: we are developers, for code sake, and a typical stereotype is that we are all better than everybody else. In few words, if we think it, knowing what others are doing about same thoughts, we are thinking "better than others", and if we are not shy to write a lot of code and test it, because we have time, why on earth we should depend again on third parts libraries?

As Summary

There is not an absolute point about these kind of choices, except one: flexibility. I do appreciate the fact BBC team at least tried jQuery library before they chose to create their own one. The point about death browsers is an excuse, IMHO, they should have been more decided about their points because if that was the reason, I do not get it at all and people talking about public money would be absolutely right. On the other hand, latest points about proprietary libraries advantages could make BBC site less problemtic, for their supported browsers, considering they know what they are doing, they had even too much time to develop 300Kb of core library comment included ( I wrote 3 times of code in one month over another library and nothing was redundant ... ), and they are (ta da ta da!!!) BBC, good to see their source code (lovely comments, not everything lovely in the code though but this is another story)

This post is just my humble opinion about a subject extremely common in this sector and interesting as well.
I am just a developer with passion for code, curiosity about ASM, C knowledge, a "JavaScript Ninja" currently technical editor of an imminent related book, with PHP Zend Engineer certifications, few Java related experiences, and daily C# exposure. In few words, I have collaborated with different companies and created internal libraries or used third parts libraries. Please consider my experience so far before you'll blame me for this post, thanks :D

P.S. I promise, I'll add every related link asap, right now my temporary Internet connection is running out of bytes!!!


{Michael : iSkitz} said...

Personally, I think all this uproar had more to do with John's unhappiness that the BBC moved away from using his jQuery library.

Yes they may have reinvented the wheel, true they had other options, but so what. They said they had multiple pre-existing internal libraries. Did they even have to share this with the Open Source community, obviously not.

Everyone complaining and berating them needs to stop being so self righteous. We're all free to choose our own implementations. They tried jQuery and decided against it for their own reasons. Does this hurt jQuery, I think not. It's been adopted by Microsoft and Nokia and has countless (vocal) fans. John and the jQuery fans should be content with that fame and continue forward with its development. It's popularity won't fade because the BBC chose to create, use and share Glow.

Time will tell if the BBC's decision was sensible. If this was such a terrible thing to do why don't we see rants from the MooTools, Prototype, dojo, or YUI teams? Maybe they value and respect choice or maybe they're less concerned with making their libraries the primary or only choice. Just my 2 cents.

Tom said...