Pro jQuery 2.0 |
Author: Adam Freeman This weighty tome is written by an enthusiast. Is it going to work for you? This is essentially a second edition of Pro jQuery brought up-to-date with few changes. The opening chapter of this brick of a book starts off by admitting that jQuery sounds pretty dull. What jQuery does is to let you modify the contents of HTML documents by manipulating the document model that the browser creates when it processes the HTML. However, Adam Freeman goes on to claim that jQuery makes DOM manipulation a pleasure and, on occasion, an actual joy. Now most of us around the I Programmer offices have our own particular pet computing obsessions - no-one accidentally opens a conversation with Mike James about artificial intelligence and the further reaches of maths, you definitely don’t want to get Janet Swift started on spreadsheets and VBA, and people have been known to throw things at me when I start talking about databases, so we do understand the pleasure that you can get from programming, but at first glance "joy" seems a bit unlikely in this context. On the other hand, anything that takes an area of web development that is usually hard work and tedious, and makes it simple, quicker and easier has got to be worth exploring, and it’s usually better to learn from an enthusiast.
The book covers jQuery itself, along with jQuery UI and jQuery Mobile, the two user interface libraries that provide extra features that you can use with jQuery for standard desktop web apps and for those for use on touchscreen mobile devices. The can be divided into six parts; an introductory section that you can use to get up to speed with any aspects such as HTML, CSS and JavaScript; working with jQuery; working with data and Ajax; jQuery UI; jQuery Mobile; and finally, advanced features. Freeman uses lots of examples, and the code can all be downloaded from APress. One nice touch is that the main chapters start with a chapter summary in the form of a table showing problems, their solutions, and which listing in the chapter shows the solution. This saves a lot of time when you’re trying to flick through to find the technique you’re stuck with. Freeman’s writing style is good, and I think he could have had a bit more background chat to balance the heavy use of code and tables. On the other hand, as the book is already perilously close to 1000 pages long, I do see the problem this would cause. In terms of the actual material, the ‘primer’ chapters on HTML, CSS and JavaScript look fine, enough to fill in any gaps. The heart of the book comes in Part 2, Working with jQuery. This takes you from your first jQuery script through using elements, manipulating the Dom, manipulating elements, working with events, using jQuery effects, and ends by putting all these aspects together to take a static HTML page and change it programmatically using jQuery to add carousel buttons, more products, event handling for paging through, and to calculate totals for the products selected.
Next comes the section on working with data and Ajax. The first chapter looks at using data templates. This uses the deprecated JQuery Templates plug-in, which is currently the best option even though Microsoft has stopped work on it. Data templates let you programmatically generate elements from the properties and values of JavaScript objects. Next, Freeman covers working with HTML forms before moving on to using Ajax. Ajax gets two meaty chapters, and is probably enough to avoid the need for a separate book. The material goes as far as handling Ajax events and setting up and filtering Ajax requests. The HTML example worked on in earlier in the book is again reworked, this time to pull the data for the products from a JSON data file, add form validation, to submit the form data using Ajax, and to process the server response. Part 4 of the book looks at using jQuery UI, and having gone through setting up jQuery UI, the chapters in this part take the various widgets in turn - the button, progress bar and sliders, autocomplete and accordion, tabs, datepicker and dialog. Freeman shows how to use drag and drop interactions, then the sortable, selectable and resizeable interactions, and how they can all be used to set up rich user interfaces in your HTML code. jQuery Mobile gives you a way to interact with touch-enabled devices. This, as Freeman says with excellent understatement, provides unique challenges for web application developers. Some elements look as though they’d be fairly straightforward to code; others less so. For example, touch events and their significance have to be interpreted by you, which Freeman says is a painful task fraught with errors and one that he recommends you avoid wherever possible. Fortunately, in a later section he shows the alternative method of using Mobile Gesture methods. This chapter also has a good section on how not to write apps for mobile devices, and what the problems and pitfalls are. Other chapters cover pages and navigation; dialogs, themes, and layouts; buttons and collapsible blocks; mobile forms and lists. The final part of the book covers advanced features such as the utility methods for handling queues and arrays. There’s a chapter on UI effects and the CSS Framework, and another on using deferred objects. I didn’t come out of the book with joy uppermost as an emotion, but I can well imagine being very grateful for the techniques shown and the time and effort they’ll save.
|
|||
Last Updated ( Monday, 14 April 2014 ) |