New Microsoft support for jQuery makes part of its platform open source
A key part of the programming model originally made popular in the early '90s by Visual Basic is the event-driven concept, where an application waits for a recognized event to occur, so that the event can trigger the execution of a procedure. The event model is simpler on a closed system, but Web programming mandates a more asynchronous approach, because the browser and the server are running independent processes, and there could be middleware -- perhaps a cloud service -- somewhere in between.
While jQuery sounds like a database language, that's not the category to which "Query" refers in this instance. Here, the idea is to change the response model for programming, so that the dynamics become less reliant upon if something happens -- less reactionary -- and more forward-thinking: when something happens.
With jQuery added, the concepts are radically simplified. Rather than write out a whole bunch of event handling functions as if the events were the subjects, you maintain the context of the objects you're working on using the event names as modifiers of that object.
Here's an example from the jQuery team's John Resig: Suppose a list element in a page has been given the name orderedlist. A default function, using jQuery syntax, responds to the event signaling the active document being "ready" (fully rendered) by forwarding a set of event-oriented instructions saying, in effect, "When the user hovers over the last element in this list, turn it green until the pointer strays off of it."
The li:last part is based on an XPath selector that has the script look for the final item in the list. The .hover event is something you'll recognize because it's a common term, but here it's being referenced as a method of the class that's returned by the selector. So every method chained onto to the end thereafter refers to the same object, and every reference to $(this) also refers to the same object -- it's shorthand for "the object at hand." So the .addClass and .removeClass jQuery functions are passed as parameters to the .hover event, essentially assigning and removing, respectively, a pre-existing CSS class green to that "object at hand."
Microsoft Vice President and ASP.NET development team leader Scott Guthrie announced this in his blog Sunday: "Providing the ability to perform selection and animation operations like above is something that a lot of developers have asked us to add to ASP.NET AJAX, and this support was something we listed as a proposed feature in the ASP.NET AJAX Roadmap we published a few months ago. As the team started to investigate building it, though, they quickly realized that the jQuery support for these scenarios is already excellent, and that there is a huge ecosystem and community built up around it already...Rather than duplicate functionality, we thought, wouldn't it be great to just use jQuery as-is, and add it as a standard, supported, library in VS/ASP.NET, and then focus our energy building new features that took advantage of it?"
As Microsoft Senior Program Manager Scott Hanselman confirmed Sunday, jQuery will eventually be shipped as part of Visual Studio, but will in the meantime be distributed as part of the new ASP.NET Model View Controller.
This officially makes an open source component part of Microsoft's standard Web page development platform.
"This is cool because we're using jQuery just as it is. It's Open Source, and we'll use it and ship it via its MIT license, unchanged. If there's changes we want, we'll submit a patch just like anyone else," Hanselman wrote. "Folks have said Microsoft would never include Open Source in the platform, I'm hoping this move is representative of a bright future."