When Frameworks Attack
I’ve learnt to be weary of web frameworks. They start out trying to make simple things easier, and inevitably end up making important things difficult. I think of frameworks like this
“They make it easy to do somethings, but impossible to do anything.”
The number of frameworks I actually trust can be counted on one finger. It’s jQuery.
And so here I am trying to get to grips with a Javascript framework by the name of ExtJS. I’ll not bore my non techie readers with the finer details, but I will take a moment to provide a small example of the kind of warped thinking that’s gone into this frame work.
Here’s a sample of code from one of the tutorials. You don’t have to understand it, just look at it and appreciate it’s size
Ext.onReady(function() { var myData = [ ['Apple',29.89,0.24,0.81,'9/1 12:00am'], ['Ext',83.81,0.28,0.34,'9/12 12:00am'], ['Google',71.72,0.02,0.03,'10/1 12:00am'], ['Microsoft',52.55,0.01,0.02,'7/4 12:00am'], ['Yahoo!',29.01,0.42,1.47,'5/22 12:00am'] ]; var ds = new Ext.data.Store({ proxy: new Ext.data.MemoryProxy(myData), reader: new Ext.data.ArrayReader({id: 0}, [ {name: 'company'}, {name: 'price', type: 'float'}, {name: 'change', type: 'float'}, {name: 'pctChange', type: 'float'}, {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'} ]) }); ds.load(); var colModel = new Ext.grid.ColumnModel([ {header: "Company", width: 120, sortable: true, dataIndex: 'company'}, {header: "Price", width: 90, sortable: true, dataIndex: 'price'}, {header: "Change", width: 90, sortable: true, dataIndex: 'change'}, {header: "% Change", width: 90, sortable: true, dataIndex: 'pctChange'}, {header: "Last Updated", width: 120, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} ]); var grid = new Ext.grid.Grid('grid-example', {ds: ds, cm: colModel}); grid.render(); grid.getSelectionModel().selectFirstRow(); Ext.get('grid-example').show(); });
The tutorial then goes onto say…
While this looks like a lot, it is really only seven lines of code in total!
But no ExtJS, it’s not is it. It’s not seven lines of code whichever way you look at it. Why lie? Any fool can see that there’s more than seven lines of code there. Of course, I suppose you could squeeze it all onto seven lines if you wanted to. But that would be almost as crazy as using your ass-backwards framework.
What’s more, 90% of those lines are alien to anyone who doesn’t already have an intimate knowledge of the ass-backwards ways you like to do things.
ExtJS sucks. Fact. Steer clear of it.