YUI vs. jQuery – Developer Energy Distribution

Put it simply with the 80 / 20 rule:

  • jQuery: 80% on your application logic + 20% on studying the API documents
  • YUI3: 20% on your application logic + 80% on studying the API documents

I might sound too prejudiced against YUI3, but my experiences has remained awful:

  • I still need to go over the documents of fundamental elements, e.g., Node & Event, again and again after months with YUI3.
  • Shortcut methods like node.show() could not handle cases where the node is set hidden by default in CSS, that I have to use other methods like node.setStyle(“display”,”block”), that the shortcut is meaningless to me.
  • The MVC modules introduced in YUI 3.4 sounds so good at first look, then when I dig into the details, I have to give it up due to huge memory overhead when dealing with 1000s of simple objects.
  • Once I need to add a context menu, which was not included in YUI3. Some “experts” suggest I need to create a new class based on Overlay or Widget, initiate an instance upon right click, render the menu, then destroy it after user clicks an item or elsewhere … I just need ONE context menu, do I need to go over all the stupid stuff to get something simple done? Eventually I finished the job with just 10 lines of RAW JavaScript + CSS!

The context menu case reminds me of the different ways to build hello world with C vs. Java:

  • main() {
        printf ("Hello World!\n");
    }
  • class HelloWorldApp {
        public static void main(String[] args) {
            System.out.println("Hello World!");
        }
    }

See the difference? With Java, you need to first create a HelloWorldApp class, which includes a public static void main method , inside the method, you need to call System.out.println to get the string out! I wonder if anyone realize the pre-requisites of Java to write a simple app like this!

  • Class definition
  • Public vs. Private methods
  • Static vs. instance methods
  • Predefined classes / instances and their methods

OO thinking is not necessarily good and procedure thinking is not necessarily bad. The world is complicated enough, and I believe it’s everyone’s responsibility to keep it AS SIMPLE AS POSSIBLE!