Pro JavaScript Design Patterns and over 1.5 million other books are available for Amazon Kindle . Learn more


or
Sign in to turn on 1-Click ordering.
Trade in Yours
For a £4.94 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Colour:
Image not available

 
Start reading Pro JavaScript Design Patterns on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Pro JavaScript Design Patterns (Recipes: a Problem-Solution Ap) [Paperback]

Dustin Diaz , Ross Harmes
3.7 out of 5 stars  See all reviews (3 customer reviews)
RRP: £32.99
Price: £28.04 & this item Delivered FREE in the UK with Super Saver Delivery. See details and conditions
You Save: £4.95 (15%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In stock.
Dispatched from and sold by Amazon. Gift-wrap available.
Want delivery by Tuesday, 28 May? Choose Express delivery at checkout. See Details

Formats

Amazon Price New from Used from
Kindle Edition £21.03  
Paperback £28.04  
Trade In this Item for up to £4.94
Trade in Pro JavaScript Design Patterns (Recipes: a Problem-Solution Ap) for an Amazon.co.uk gift card of up to £4.94, which you can then spend on millions of items across the site. Trade-in values may vary (terms apply). Learn more

Book Description

10 Dec 2007 159059908X 978-1590599082

As a web developer, you’ll already know that JavaScript is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked—JavaScript is capable of full object–oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team.

With Pro JavaScript Design Patterns, you’ll start with the basics of object–oriented programming in JavaScript applicable to design patterns, including making JavaScript more expressive, inheritance, encapsulation, information hiding, and more. With that covered, you can kick–start your JavaScript development in the second part of the book, where you’ll find detail on how to implement and take advantage of several design patterns in JavaScript, including composites, decorators, façades, adapters, and many more.

Each chapter is packed with real–world examples of how the design patterns are best used and expert advice on writing better code, as well as what to watch out for. Along the way you’ll discover how to create your own libraries and APIs for even more efficient coding.

  • Master the basics of object–oriented programming in JavaScript, as they apply to design patterns.
  • Apply design patterns to your kick–start your JavaScript development.
  • Work through several real–world examples.

What you’ll learn

  • How to apply object–oriented programming techniques in JavaScript
  • How to take advantage of inheritance, interfaces, and encapsulation and information hiding to kick–start your JavaScript development
  • How to implement several design patterns in your JavaScript projects, including factory, façade, bridge, composite, adapter, decorator, flyweight, proxy, command, observer, and chain of responsibility
  • How to make your code easier to manage in a team environment, as well as on your own
  • How to create your own libraries and APIs

Who this book is for

This book will be an invaluable learning tool for any experienced JavaScript developer.

Table of Contents

  1. Expressive JavaScript
  2. Interfaces
  3. Encapsulation and Information Hiding
  4. Inheritance
  5. The Singleton Pattern
  6. Chaining
  7. The Factory Pattern
  8. The Bridge Pattern
  9. The Composite Pattern
  10. The Facade Pattern
  11. The Adapter Pattern
  12. The Decorator Pattern
  13. The Flyweight Pattern
  14. The Proxy Pattern
  15. The Observer Pattern
  16. The Command Pattern
  17. The Chain of Responsibility Pattern

Frequently Bought Together

Pro JavaScript Design Patterns (Recipes: a Problem-Solution Ap) + JavaScript Patterns + JavaScript: The Good Parts
Price For All Three: £57.46

Buy the selected items together
  • JavaScript Patterns £14.71
  • JavaScript: The Good Parts £14.71


Product details

  • Paperback: 269 pages
  • Publisher: APRESS (10 Dec 2007)
  • Language: English
  • ISBN-10: 159059908X
  • ISBN-13: 978-1590599082
  • Product Dimensions: 18 x 1.9 x 23.5 cm
  • Average Customer Review: 3.7 out of 5 stars  See all reviews (3 customer reviews)
  • Amazon Bestsellers Rank: 398,972 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

About the Author

Dustin Diaz is a User Interface Engineer who enjoys writing JavaScript, CSS, and HTML as well as making interactive and usable interfaces to create passionate users. After working a series of jobs with titles like Freelance Programmer, IT Consultant and Web Developer on the east coast, Ross Harmes now works as a Front End Engineer for Yahoo! Small Business in Sunnyvale, California. He is the owner of the open source project Birch, an easily installable photoblog. He and Tristan have been making websites together since 1994 (those first few were shockingly ugly and have thankfully disappeared into the ether), and will continue to do so until they pry the keyboards out of their cold, dead hands. On the weekends, Ross can be seen biking around the Bay Area hills and streets.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?


Customer Reviews

5 star
0
2 star
0
1 star
0
3.7 out of 5 stars
3.7 out of 5 stars
Most Helpful Customer Reviews
4 of 4 people found the following review helpful
3.0 out of 5 stars A mixed bag. Informative but at times cryptic. 7 Nov 2010
Format:Paperback
This book gets 5 stars for illustrating Design Patterns within the context of usable examples. It's not as abstract as the Gang of Four book, much more in the realm of a Cookbook of practical examples.
But the book also has its flaws.
* For one thing, duck typing as I understand it from the realms of using Groovy, doesn't mean you have to adhere to an interface, just provide the methods.
Their implementation ties things together via an intermediary interface. To adhere to duck typing, the intermediary interface shouldn't strictly be necessary.
* Their interpretation on how to implement an interface solely relied on the presence of a function/method name. Coming from a Java background originally, seeing a class implementing a method by name alone seems insufficient. The signature of the methods is also crucial. There were no assertions on the types or number of the arguments passed, which I thought an interface should adhere to.
(I realise JavaScript is a dynamic language, so maybe there was grounds for this, but informing the readers why they went with the implementation they did warranted a discussion).

The book also tends to fail in certain areas :
* At times the book would make a suggestion as to something you could do, without showing an example :
** eg lazy loading Observer P223.
** Also, whenever the book forayed off into the realm of Ajax, server-side references were made to PHP scripts that weren't contained in the book (or code download :-( ).
(example Chapter 7 Factory Pattern P107. The section on whitelisting was described. I was rather disillusioned not to see such code within the pages of the book showing how this is done).

* At times the book would show a revised version of some code, without pinpointing the salient changes in the narrative, so you had to really study and compare code.
(eg P248/9 - should have mentioned argument was now being passed in to function)

* Chapter 6 on Chaining. The concept is something I'm familiar with, having used jQuery, but the tail end of the chapter seemed too cryptic for my taste. Too many missing pieces of the puzzle.

* The lack of descriptive argument names for closure functions. Specifically:
** 1) string replace (page 152) - It can take a regular expression and closure as arguments. The closure itself is described with arguments called 'a' and 'b'. This is so unhelpful. If the string replace takes the regular expression/closure arguments, then I believe the arguments should be of the format capture group 1, capture group 2, .... capture group n, position, original text. As there was only one capture group I couldn't get my head around the code with all the cryptic variable names.
** 2) JavaScript 1.6 array functionality (some/filter) : These methods take a function closure that should return a boolean for each element in the array that is being processed : P219/220. As far as I'm aware the inner closure that these methods uses takes 3 arguments, the first is the item of the array, the second the index position. the third the array itself. I'm wondering if you specify a single argument ths just would be the item.... It seems quirky that the third argument is ever needed, since this is the array you are running some/filter upon to begin with...) But the author just uses a name e1. To me this just has no meaning whatsoever. And a return statement without a boolean seems plain wrong in the context of the some/filter closures.
* P237 getContext('2d') - wasn't described. (I've since read about this in Pro HTML5. It's used in conjunction with the canvas tag, for two-dimensional graphics rendering. That book pointed out the fragility of this code. Canvas isn't available in all browsers and the code should be in a try catch block. Internet Explorer is the usual suspect here!).
* P238 I couldn't see why author didn't move undo functionality into UndoDecorator, undo function itself..

* From time to time, the ordering of the code didn't help:
** (Chapter 8: example P110 - ssynchRequest. I suddenly though authors had gone all YUI on me (This is not native JavaScript). Only to find it mentioned for first time on P112. A quick heads up this is about to be covered would have worked wonders)
** (example P171/172. The code at top of P171 should have been shown first. This way by the time you get to see the function, you appreciate why it's been coded is such a way).

* The author seems to flit between naming variables for functions with a lowercase at the start of the book, but by the end has flitted to uppercase. I thought uppercase variable names was supposed to be reserved for classes.
* P132 ev should be e.
* Chapter 8 P112 Why have send with (postData || null). The or null seems redundant. Describe reasoning. (Dustin tells me this is to translate undefined to null - as the send method only likes null or data)
* Chapter 9 P131. Comment about implementation with Cookies not being best approach. Why give an example that is lame? Give me examples that are production ready! This is a 'Pro' series book right?
* Chapter 12 (Decorator) has errors in the code. It's worth looking at the errata on the APress website here. It revolves around the use of 'this' to assign the superclass constructors.
I think all of the Decorators in this chapter suffer from same fate, not just the one described. There seems to be a repeating pattern (pun intended)!

If some of these issues had been addressed, I would have had no hesitation in awarding the book five stars, as it was an engaging and enjoyable read. It wasn't too heavy either, something you can easily read in a weekend.
Comment | 
Was this review helpful to you?
4 of 4 people found the following review helpful
4.0 out of 5 stars Very informative 2 Dec 2009
Format:Paperback
I used this book to attempt to get a better understanding of Javascript and it served this purpose remarkably well. I am a professional programmer by trade so I already know design patterns very well having studied the infamous "Gang of Four" book. This meant that I could look at each design pattern and see how it was implemented compared to other languages I know and see how they differed and how they were similar which was quite an interesting way of learning.

The book does however feature a very detailed look into how to write good Javascript in the first few chapters which was very useful. What it doesn't cover is things such as basic control structures, data types etc which you'd find with a more beginners book.

The writers do a very good job of explaining each design pattern and the pro's and con's of each, when you'd use it and then how to implement it. They take a very terse dry subject and make it very readable. However this is by no means a comprehensive list of all the design patterns there are. It has the basics and that's it, but by the end of it you'll be competent enough to figure out the others by yourself.

This along with Douglas Crockford's "Javascript the good parts" will keep you in good stead with any Javascript project.
Comment | 
Was this review helpful to you?
1 of 3 people found the following review helpful
4.0 out of 5 stars Pro JavaScript Review 20 Sep 2010
By Segun
Format:Paperback|Amazon Verified Purchase
The level of JavaScript required on some project I was working on made me feel very dumb, this book was recommended, I bought it, read only the first few chapters and felt less dumb right away, especially as it said 'not knowing that level of JS does not mean you are dumb'. I've not gotten past those chapters by the way, I hope to do so at some point though.
Comment | 
Was this review helpful to you?
Would you like to see more reviews about this item?
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 

Search Customer Discussions
Search all Amazon discussions
   
Related forums


Listmania!


Look for similar items by category


Feedback


Amazon.co.uk Privacy Statement Amazon.co.uk Delivery Information Amazon.co.uk Returns & Exchanges