Automotive Deals HPCC Amazon Fashion Learn more Discover it Jake Owen Fire TV Stick Sun Care Handmade school supplies Shop-by-Room Amazon Cash Back Offer CafeSociety CafeSociety CafeSociety  Amazon Echo  Echo Dot  Amazon Tap  Echo Dot  Amazon Tap  Amazon Echo Introducing new colors All-New Kindle Oasis AutoRip in CDs & Vinyl Segway miniPro STEM

Pro JavaScript Design Patterns: The Essentials of Object-Oriented JavaScript Programming

Sign in to turn on 1-Click ordering
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

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

Pro JavaScript Design Patterns: The Essentials of Object-Oriented JavaScript Programming [Paperback]

Dustin Diaz , Ross Harmes
4.5 out of 5 stars  See all reviews (29 customer reviews)

List Price: $44.99
Price: $32.83 & FREE Shipping on eligible orders. Details
You Save: $12.16 (27%)
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.
Ships from and sold by Gift-wrap available.
Want it Tuesday, Aug. 2? Choose One-Day Shipping at checkout. Details
Free Two-Day Shipping for College Students with Prime Student Free Two-Day Shipping for College Students with Amazon Student


Price New from Used from
Paperback $32.83  
New York Times best sellers
Browse the New York Times best sellers in popular categories like Fiction, Nonfiction, Picture Books and more. See more

Book Description

December 16, 2007 159059908X 978-1590599082 1st

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 object-oriented 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: The Essentials of Object-Oriented JavaScript Programming + JavaScript Patterns + JavaScript: The Good Parts
Price for all three: $72.39

Buy the selected items together

Editorial Reviews

About the Author

Dustin Diaz is a user interface engineer for Google in Mountain View, California. He enjoys writing JavaScript, CSS, and HTML, as well as making interactive and usable interfaces to inspire passionate users.

Product Details

  • Paperback: 269 pages
  • Publisher: Apress; 1st edition (December 16, 2007)
  • Language: English
  • ISBN-10: 159059908X
  • ISBN-13: 978-1590599082
  • Product Dimensions: 7 x 0.7 x 9.2 inches
  • Shipping Weight: 1.3 pounds (View shipping rates and policies)
  • Average Customer Review: 4.5 out of 5 stars  See all reviews (29 customer reviews)
  • Amazon Best Sellers Rank: #323,036 in Books (See Top 100 in Books)

Customer Reviews

4.5 out of 5 stars
4.5 out of 5 stars
Share your thoughts with other customers
Top Customer Reviews
35 of 37 people found the following review helpful
Design patterns, and particularly their application in dynamic languages can be a controversial topic, and every now and again another round of blog posts bubbles up appalled at the way a new group of programmers have become infatuated with design patterns. Applied without care design patterns can quickly lead to over-engineered code that seems designed as much to draw on as many of the established patterns as possible as to solve the intended problem. But if applied with care, and with consideration of how a pattern applies in the context of your chosen language they can be a helpful way to draw on the wisdom of the coders that came before you, and make your code easier to understand to those who may inherit it.

Written by Dustin Diaz (of Google) and Ross Harmes (of Yahoo), Pro Javascript Design Patterns builds on experience of building complex, high profile javascript applications. That experience shows as each pattern is introduced with solid examples and sample code and then refined to provide looser-coupling, more flexibility and/or better performance.

Early on in the book I was concerned that some of the solutions could become too heavy and the early introduction of interfaces hinted at something akin to the early approaches to pattern usage in PHP, which often looked more like an attempt to turn PHP into Java than a way to use PHP's own features better. As the book goes on the usefulness of those interfaces, particularly for large development teams, becomes clear and most of those concerns are allayed, especially as the authors offer pros and cons for the use of each pattern and are clearly focussed on how these patterns can help produce more robust solutions.
Read more ›
Comment | 
Was this review helpful to you?
Report abuse
16 of 17 people found the following review helpful
5.0 out of 5 stars Toughie not fluffy March 25, 2008
By emh425
This book is a "JavaScript for Programmers" book. It's very detailed and advanced. I wouldn't classify it as a "JavaScript for Web Weenies" or a "JavaScript for Stupid UI Tricks" book at all. If you don't know OOP concepts in another language already, this book really might be too much for you and could frustrate you. This book is good if you are a server-side programmer and you want to know how to push JavaScript about as far as it can go (at this point). If you are a web programmer/designer with a light understanding of OOP concepts and you want to "go deep", this book could be ok, but I would try to learn OOP from another language first because this book would read better with that background knowledge. Also, I am recommending that you already know OOP from another language because you can really shoot yourself in the foot with JavaScript because it's *so* flexible and the authors prove this well! I think it's probably a good idea to know when you're going off in the weeds and JavaScript really doesn't provide many boundaries where other languages have stricter controls on what you can do.

This book shows that when used by an experienced person, JavaScript is no joke. Seriously.
Comment | 
Was this review helpful to you?
Report abuse
10 of 10 people found the following review helpful
5.0 out of 5 stars Great Design Pattern Book May 27, 2009
When you read the book, "Pro JavaScript Design Patterns" from Ross Harmes and Dustin Diaz, it's clear that Ross and Dustin have a strong understanding of JavaScript, its strengths, and its limitations. JavaScript has a lot of stengths, in that it supports dynamic typing at runtime, public and private typing of members, flexible coding style , and existing support of class/object development. Its weaknesses, such as support for other constructs, like explicit namespaces or interface support, the writers attempt to make up for by showing potential workarounds to the issue.

The first three chapters setup some of the more complex topics: flexibility and mutability of objects, dynamic typing, structuring of classes and how to assign methods to an object's prototype. Another important subject is the differentiation between public and private members, and how these members are scoped and accessed in the class's instance.

Speaking of classes, there are a couple of different ways to setup class definitions and inheritance. The first option is prototypical inheritance, where the derived class inherits the members of the base class. Other options are mixin classes, using a helper method to copy over class definitions from one object to another. This book, with great detail, discusses the differences between the two options.
The book continues to discuss the following design patterns, and implements in full JavaScript. The concepts in the first four chapters, discussed above, are reused in the design pattern process. Each chapter highlighted below has an explanation, example (or several), guide on when to implement, pros, cons, and summary.
Read more ›
Comment | 
Was this review helpful to you?
Report abuse
19 of 23 people found the following review helpful
2.0 out of 5 stars Not as good... March 19, 2010
I quit reading this book.
Do not misunderstand me: the writing style is clear and the authors seem to know the topic.
By the way, after having read the "JS Good Parts" and started reading "Secrets of the JS Ninja", i can't help to find the chapters of this book kind of "overengineered".
JS has a beautiful prototypal nature, so why do force it to be like Java? I found some of the patterns useful, but definitively do not like the dependence on the interface pattern (give me open classes please!). Believe me: as Crock and Resig teach us, JS can be used according to its natural mood in a much effortless way. Said that this isn't a bad book, simply not as good...
Was this review helpful to you?
Report abuse
Most Recent Customer Reviews
5.0 out of 5 stars Five Stars
great product...exactly as i wanted it!!
Published 5 months ago by Amazon Customer
5.0 out of 5 stars Excellent book on javascript OOP design
I don't have the book. But luckily I read a complete chapter of the book by using the look inside feature in Amazon and found the answer to my question. Read more
Published 9 months ago by Anthony Shih
4.0 out of 5 stars ... interested in OOP javascript this is one of the best books.
For those who are interested in OOP javascript this is one of the best books.
Published 14 months ago by dante
5.0 out of 5 stars Good Useful Read
Last week I finished reading it and I just wanted to say how much I enjoyed it. Well structured and written, good, well explained and clear code snippets that, for the most part,... Read more
Published on May 1, 2014 by Vlad GURDIGA
5.0 out of 5 stars Great for more advanced scripting
Everything is clearly explained, and the code is very useful. A very good framework to base an advanced project on.
Published on November 19, 2013 by Brian G Jacobs
5.0 out of 5 stars I love it !!!
I like that kinds Of books because fulfill my expectations so, thanks for your recommendations

I like the variety of books your have and quality .

Published on September 15, 2013 by luis
5.0 out of 5 stars Worth every penny
This book flows well, covers the content in a way that made sense, and helped me fall in love with javascript....
Published on March 21, 2012 by Lee J. Wolfe
5.0 out of 5 stars Pro JavaScript Design Patterns is a must have...
For any serious front end / JavaScript developer, Pro JavaScript Design Patterns is a must have! Descriptions are written clearly and the code examples are copious. Read more
Published on October 12, 2011 by Bill Smythe
5.0 out of 5 stars Not for the faint at heart, but very important core concepts
Let me just say this up front--this book contains some advanced JavaScript techniques and code, and is not for the beginning or even intermediate JavaScript programmer. Read more
Published on March 14, 2011 by Craig Cecil
5.0 out of 5 stars Improve JS skills
Excellent book for every Javascript developer who wants to improve his programming skills. It's framework independent so it's usable for all JS developers...
Published on September 23, 2010 by Peter W
Search Customer Reviews

Set up an Amazon Giveaway

Pro JavaScript Design Patterns: The Essentials of Object-Oriented JavaScript Programming
Amazon Giveaway allows you to run promotional giveaways in order to create buzz, reward your audience, and attract new followers and customers. Learn more about Amazon Giveaway
This item: Pro JavaScript Design Patterns: The Essentials of Object-Oriented JavaScript Programming

What Other Items Do Customers Buy After Viewing This Item?

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more


Pages with Related Products. See and discover other items: javascript

Look for Similar Items by Category