Friday, September 7, 2012

jQuery UI Tabs issue in MVC 4

I was trying to set up the jQuery UI Tabs sample in an ASP.Net MVC 4 application and got the following error in the console:

Uncaught TypeError: Object #<Object> has no method 'tabs'

It turned out that jQuery was not yet loaded at the time the .tabs() method was being called.  Scripts must be loaded in the correct order or the code they're referencing may not be available.  I had the bit in the document ready block but was still having a problem. The problem in the MVC case seemed to be the mix of using both MVC bundles and script tags. There is likely a proper way to do it if I were to read more about bundles and when they're loaded, etc. 

I decided to put all the script resources into bundles and loaded them that way and I left the bit of code calling $('#tabs').tabs() in a script tag. Still no luck. So I deleted that script tag, loaded my page, made sure all scripts were available and then in the chrome javascript console I entered $('#tabs').tabs() and BAM, the tabs appeared.  This proved that the script fragments were not being run in the order I had expected so I put the code in a separate js file and loaded it in a bundle as well and everything worked.

So if you're using Bundles, it appears your best bet is to use them across the board and not mix and match with inline script tags.

Thursday, September 6, 2012

Understanding the Resistance to Agile

I have been reading some architecture documentation for a set of services that are part of a much larger system. In one section of the document, after a brief (and incorrect) description of Entity Framework, I encountered this paragraph:
This framework was chosen to support agile development. The developer does not need to write any data access logic, other than creating the entity data model, and the framework was built to work directly with the Windows Communication Foundation DataService class.
Firstly, this statement misconstrues the meaning of Agile Development. Agile Development has nothing to do with what code is written or which framework is chosen. Agile development is about enabling the developers and about being able to develop amidst a rapidly changing environment towards an often incorrectly or partially defined target. The first value defined by the agile manifesto (http://agilemanifesto.org/) states that we value "Individuals and interactions over processes and tools" yet this statement is all about choosing tools (EF and WCF).


No wonder there is resistance to Agile Development when there are people spreading falsehoods like this around.

I still can't believe what I've just read... not to mention I read it in an overly "comprehensive" 67 page document.  As if a description of EF was necessary; a link to the official Microsoft documentation on EF would have sufficed.