JavaScript Web Applications |
Author: Alex MacCaw Publisher: O'Reilly Pages: 280 ISBN: 978-1449303518 Aimed at: Proficient JavaScript developers Rating: 4 Pros: Tackles a difficult topic Cons: Niche and not necessarily the right way to tackle it Reviewed by: Ian Elliot This book has an intriguing subtitle - Guide to Moving State to the Client. What does this imply? Author: Alex MacCaw This book has an intriguing subtitle - Guide to Moving State to the Client. This is a idea I can sign up to if only to reduce the load on the server and make all those lazy clients do something for their living. The book is also jQuery based and promotes the MVC model at the right way to do things. While I like jQuery and approve of its use I am not so convinced about MVC in this context. Neither am I convinced by the authors all too common attempt to make JavaScript fit into the traditional class based programming style. This is an attempt to make JavaScript look more like Java complete with class like definitions and inheritance. JavaScript doesn't do strong typing so what the point of imposing a class structure on it is I'm not sure. Given that inheritance isn't well thought of in by many practicing programmers why struggle to implement it in JavaScript where it isn't needed. Of course you may not agree and welcome forcing of the language to fit in with the standard paradigm.
The book opens with a look at MVC and the imposition of a class system on JavaScript. Although the author attempt to explain things simply at first he very quickly forgets that many readers aren't used to the amazing things that JavaScript can be coaxed into doing. Chapter 1 is a mini-overview of advanced JavaScript and many will find it far too difficult to follow because it just isn't explained. From here we move on to an implementation of an event handling system. Then on to the MVC components Models and data including JSON and JSONP as inputs to an ORM. Next we look at controllers and state and then views and templating.Chapter 9 looks at dependency management using the Common.js module approach. From this point on the book looks at many more basic tasks. Chapter 7 is about working with files including the jQuery drag and drop file uploader. Chapter 8 is on web sockets, chapter 9 is on testing and debugging and chapter 10 is on deployment - caching, minification, CDNs etc. The final three chapters are on the Spine library, the Backbone library and the JavaScriptMVC library all of which make implementing a class based MVC app much easier. This is a difficult book to review because for the right reader it will be an interesting read. Even if you don't agree with many of the convoluted ways of achieving results you will find much to exercise the brain and a lot of examples you can use to discover more about how you think things should be done. However, it is important that you don't simply read and accept what is said as being best practice and the only way to do things. Many, if not all, of the ideas are simply imports of the standard class based way of working and they often struggle to make JavaScript behave like Java or C#. There are also some practical problems in that the book doesn't pay too much attention to the problems of having to support a range of browsers. It is all very well to assume that all browsers support HTML5 features, but in practice they don't. Turning the ideas described into something practical is going to take a lot of work. Again, it could be that a simpler overall design might make this easier. Don't even bother considering this book if you aren't reasonably good at JavaScript programming. This isn't for the beginner and ideally you need to be a bit of an expert. Finally the biggest problem with this book is that it doesn't give you any help to become a JavaScript expert - you either figure out how things work on your own or you don't. An enjoyable book for the advanced JavaScript programmer.
|
|||
Last Updated ( Wednesday, 26 October 2011 ) |