JavaScript Patterns and over one million other books are available for Amazon Kindle. Learn more

Vous voulez voir cette page en français ? Cliquez ici.


or
Sign in to turn on 1-Click ordering.
or
Amazon Prime Free Trial required. Sign up when you check out. Learn More
More Buying Choices
Have one to sell? Sell yours here
Start reading JavaScript Patterns on your Kindle in under a minute.

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

JavaScript Patterns [Paperback]

Stoyan Stefanov
5.0 out of 5 stars  See all reviews (4 customer reviews)
List Price: CDN$ 34.99
Price: CDN$ 19.75 & FREE Shipping on orders over CDN$ 25. Details
You Save: CDN$ 15.24 (44%)
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
Only 7 left in stock (more on the way).
Ships from and sold by Amazon.ca. Gift-wrap available.
Want it delivered Friday, July 11? Choose One-Day Shipping at checkout.

Formats

Amazon Price New from Used from
Kindle Edition CDN $14.57  
Paperback CDN $19.75  

Book Description

Oct. 1 2010 0596806752 978-0596806750 1

What's the best approach for developing an application with JavaScript? This book helps you answer that question with numerous JavaScript coding patterns and best practices. If you're an experienced developer looking to solve problems related to objects, functions, inheritance, and other language-specific categories, the abstractions and code templates in this guide are ideal—whether you're using JavaScript to write a client-side, server-side, or desktop application.

Written by JavaScript expert Stoyan Stefanov—Senior Yahoo! Technical and architect of YSlow 2.0, the web page performance optimization tool—JavaScript Patterns includes practical advice for implementing each pattern discussed, along with several hands-on examples. You'll also learn about anti-patterns: common programming approaches that cause more problems than they solve.

  • Explore useful habits for writing high-quality JavaScript code, such as avoiding globals, using single var declarations, and more
  • Learn why literal notation patterns are simpler alternatives to constructor functions
  • Discover different ways to define a function in JavaScript
  • Create objects that go beyond the basic patterns of using object literals and constructor functions
  • Learn the options available for code reuse and inheritance in JavaScript
  • Study sample JavaScript approaches to common design patterns such as Singleton, Factory, Decorator, and more
  • Examine patterns that apply specifically to the client-side browser environment

Frequently Bought Together

JavaScript Patterns + JavaScript: The Good Parts + JavaScript: The Definitive Guide: Activate Your Web Pages
Price For All Three: CDN$ 71.47

Show availability and shipping details

  • In Stock.
    Ships from and sold by Amazon.ca.
    FREE Shipping on orders over CDN$ CDN$ 25. Details

  • JavaScript: The Good Parts CDN$ 18.80

    In Stock.
    Ships from and sold by Amazon.ca.
    FREE Shipping on orders over CDN$ CDN$ 25. Details

  • JavaScript: The Definitive Guide: Activate Your Web Pages CDN$ 32.92

    In Stock.
    Ships from and sold by Amazon.ca.
    FREE Shipping. Details


Customers Who Bought This Item Also Bought


Product Details


Product Description

Book Description

Build Better Applications with Coding and Design Patterns

About the Author

Stoyan Stefanov is a Yahoo! web developer, Zend Certified Engineer, and an author, contributor, and tech reviewer of various O'Reilly books. He speaks regularly about web development topics at conferences and on his blog at www.phpied.com. Stoyan is the creator of the smush.it image optimization tool and architect of Yahoo's performance optimization tool YSlow 2.0.


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

What Other Items Do Customers Buy After Viewing This Item?


Customer Reviews

4 star
0
3 star
0
2 star
0
1 star
0
5.0 out of 5 stars
5.0 out of 5 stars
Most helpful customer reviews
1 of 1 people found the following review helpful
5.0 out of 5 stars A fantastic book Dec 1 2012
Format:Paperback|Verified Purchase
I've been programming for years, and while I've enjoyed many other JS books including "The Good Parts" nothing brought it together for me like this. IMHO it's simply the best book on the subject. If you know other languages, yet are always wondering about those weird JS techniques, and the reasons behind them, this is the book for you. It led me to a few ah-ha moments and has really helped me better understand JS programming. No matter what your level of experience, you'll get something from this book. It's a gem.
Was this review helpful to you?
5.0 out of 5 stars Excellent Guide for the JavaScript Noob May 19 2014
Format:Paperback|Verified Purchase
This book is a great resource for anyone who is now learning JavaScript or just stumbled upon it. Stefanov does a great job at explaining what are some of the most common pitfalls people make when writing JavaScript. I would definitely recommend this book.
Was this review helpful to you?
5.0 out of 5 stars Gold throughout March 10 2013
Format:Paperback|Verified Purchase
If you're a beginner you don't need a book, you go online and read on some basics.
If you're a pro you do need a book and this is the book you need.
Was this review helpful to you?
By Amy Lo
Format:Paperback|Verified Purchase
This book is great for intermediate to advanced Javascript developers who wish to brush up on their Javascript. The book contains many great ideas on how to write better Javascript applications by following tried and true Javascript patterns. For beginners, the code examples help a lot, but they may take a longer to follow the concepts and code. Anyone having read this book will walk away a better Javascript developer.
Was this review helpful to you?
Most Helpful Customer Reviews on Amazon.com (beta)
Amazon.com: 4.7 out of 5 stars  71 reviews
81 of 83 people found the following review helpful
5.0 out of 5 stars Hit the sweet spot for me! Oct. 14 2010
By Amazon Customer - Published on Amazon.com
Format:Paperback|Verified Purchase
It's often difficult to find good intermediate to advanced technical books that help you get over the hump. This is most definitely one of those books, IMO, along with Javascript: The Good Parts by Crockford and High Performance JavaScript by Zakas.

If you're a beginner, even an ambitious beginner, such as an experienced programmer in another language, you don't want to start here. For beginners, I'd recommend Zakas (Javascript for Web Developers) as the most complete introduction to Javascript, the DOM and browser scripting; or Simply JavaScript from Sitepoint for a gentler introduction that emphasizes the separation of structured content (HTML), presentation (CSS) and behavior (scripting the DOM with Javascript).

OTOH, if you're more or less comfortable with core Javascript and the DOM but want to clarify and explore the many idiosyncracies and fine points of JS, this book really hits the sweet spot. The table of contents is available on Amazon or O'Reilly, so I won't recap it - but will mention that Stefanov both chooses his topics and covers and organizes his material very well. This is a precisely and well-written book, and the reader will infer that there must have be a lot of experience, previous history and discussions behind these 200+ pages. I've read the blogs of the majority of his technical reviewers and believe you're in good hands here. I'm really lovin' this book. The only caveat - don't expect a lot on browser scripting. However, I'd be surprised if the somewhat experienced, but non-ninja, Javascript programmer did not significantly take his/her knowledge to a higher level after reading JavaScript Patterns.

* * *

Addendum: I was interrupted by a rush job during my initial reading of this book and after returning to it now and rereading the early chapters and carefully reading several of the later chapters, I'm even more impressed by this book. The heart of the book, when it gets a little more advanced (functions, object creation patterns and code re-use patterns) has proved really valuable.
29 of 30 people found the following review helpful
5.0 out of 5 stars At last! A readable, expert book on JavaScript patterns Oct. 24 2010
By Lars Tackmann - Published on Amazon.com
Format:Kindle Edition|Verified Purchase
This book is not for the newbie JavaScript programmer (for the complete beginner I suggest JavaScript: The Missing Manual). It assumes some deep knowledge about the language and one is well advised to have read Douglas Crockford's JavaScript: The Good Parts before venturing into this book. Having said that, this book is just simply amazing!. It is very obvious that the author knows his subject, knows how to write and knows what problems people actually have. This is no small feat, as most programming books usually fails in one or more of these areas.

The book covers numerous inheritance and code reuse techniques, including most of the GOF patterns, but does also suggest several novel ways to take advantage (and not hack around) JavaScripts prototypical nature. I especially liked the code "tours", where the author spends considerable time developing a solution step by step, demonstrating pitfalls and side effects while simultaneously anticipating questions the reader might have. These JavaScript vistas has added considerably to my knowledge of the language, and I expect I will comeback to them again in the future (this book can easily take a second and third reading).

In summary, a very elegant written book containing an incredibly amount of knowledge, at a great price. Quite possible the best book on JavaScript in existence - highly recommended.
21 of 22 people found the following review helpful
5.0 out of 5 stars Really useful book Nov. 3 2010
By Juan Adalberto Anzaldo Moreno - Published on Amazon.com
Format:Paperback
This book is really awesome, from the beginning to the end, the author shows useful tools to improve the javascript programming.

With more than 30 patterns the author goes from basic concepts, such as avoiding globals, using single var declarations, precaching length in loops, following coding conventions, running JSLint, etc., to advanced ones like variable hoisting, select algorithms at runtime, proxy objects, loading strategies, javascript optimization and a lot of more.

What I liked about the book was the way in which the author explains and illustrates the patterns and how well organized the book is written, this book helped me to understand in a better way some javascript techniques with several solutions to a common scenarios.

I recommend this book if you want to write better code, if you want to understand how the libraries are written or if you want to write your own javascript library. It helps a lot to understand the javascript core and the fundamentals and helps also to be more productive taking care of performance and maintenance of javascript code.
16 of 17 people found the following review helpful
4.0 out of 5 stars applying the lessons learned from The Good Parts Dec 5 2010
By R. Friesel Jr. - Published on Amazon.com
Format:Paperback|Verified Purchase
If you're a JavaScript developer, you would be wise to have this on your bookshelf--nestled nicely between JavaScript: The Good Parts and High Performance JavaScript (Build Faster Web Application Interfaces). The three make a nice little troika.

And read them in that order: The Good Parts, Patterns, and then High Performance.

Here's why:

What Stefanov gives us with this book is effectively an overview [1] of best practices for JavaScript development, going over the benefits and gotchas of certain important language features, and translating those into design and implementation patterns. Many of these patterns are language-agnostic--and you're likely to recognize them from "The Gang of Four"--but Stefanov puts them in their JavaScript party dresses and takes them out to the ball. Wisely, Stefanov also presents these patterns in an environment/host-independent fashion, so the lessons you learn about encapsulation or inheritance or performance should be equally valid regardless of whether you're coding for the browser [2] or NodeJS or some image exporting automation for Adobe Illustrator. Stefanov is also a lucid and concise author, clearly illustrating his points about these design patterns; the text is accessible--easy to follow and digest--and he is careful to clearly define words and terms that might be ambiguous or commonly misunderstood (e.g., "function expression" vs. "function declaration" vs. "function literal").

JavaScript patterns makes a great transition guide for intermediate developers--the men and women who have stopped confusing jQuery-the-library with JavaScript-the-language--the folks who are ready to re-evaluate their approach software development with JavaScript. This is for the folks that made it through Crockford's The Good Parts knowing that they learned something but also feeling less-than-certain about how to apply that something. This is the follow-on; JavaScript Patterns is the application of those lessons. And then after you've written your clean, maintainable, scalable applications--then you make the jump to Zakas' High Performance JavaScript to tune things just a little bit further.

So you're probably wondering then: if you recommend it so highly, why only four stars?

The four stars comes mostly from two niggling points:

(1) Relative to The Good Parts and High Performance, JavaScript Patterns was not published in the order that I recommend reading them. As a consequence, since I'd read the others (and quite a few others above and beyond those two), there is quite a bit of information in there that I'd seen before. This is not a Bad Thing; sometimes it pays to see information presented again--to help it sink in or else to gain another perspective on it. And in some cases Stefanov offers an as-good-or-better explanation on certain topics/techniques as others writing in the field (e.g., his examples for memoization and currying rival Crockford's, and his explanation of the pub/sub pattern (and custom event design) is more concise than the one Zakas presents in Professional JavaScript for Web Developers). Sometimes (and I've written this before) you were just hoping for... just a little bit more.

(2) And this is super nit-picky but... The book could have taken another quick editorial pass for spelling and grammar. The one that stuck out at me was right in the intro to Chapter 6: "But it's important to keep the end goal in mind--we want to reuse cod;." Indeed.

---

1 : An in-depth overview, but an overview nonetheless.

2 : Stefanov is careful to "keep the browser out of it" and dedicates only one chapter (Chapter 8: DOM and Browser Patterns) to the subject; though everyone's favorite host environment does creep in a couple of times, in a couple of examples.
6 of 7 people found the following review helpful
5.0 out of 5 stars Thorough Treatment of JS Patterns March 17 2011
By Michael T Bolin - Published on Amazon.com
Format:Paperback
Stoyan does a great job of introducing and explaining JavaScript patterns that are in use today. He does not shy away from advanced topics and packs an impressive amount of high-quality material into 200 pages. I think a lot of people who want to learn JavaScript quickly turn to JavaScript: The Good Parts because its brevity appeals to them, but I think most of those people would be better served starting with Stoyan's book, even though it is more advanced. Stoyan's explanations are thorough, so newcomers who are eager to learn, will.

For example, one of the particularly tricky topics is the pattern for emulating "classical inheritance" in JavaScript. Fortunately, Stoyan walks through this carefully in Chapter 6, building up to the "Holy Grail" example, giving the right amount of detail that this topic deserves. He follows with alternative code reuse patterns, but does a great job in objectively discussing the tradeoffs between the various patterns.

I also appreciated how DOM/browser-specific patterns were separated into their own chapter (Chapter 8), and that the majority of the book focuses on patterns that universally apply to JavaScript, independent of the environment in which it is used. Thus, everything in chapters 1-7 is just as applicable in the browser as it is on a NodeJS server or in the Windows Script Host.

Finally, it's worth noting that I found impressively few errors in this book. Some technical books are riddled with errors (particularly in the code samples), sending people down the wrong path, but not this one! Clearly a lot of care went into producing this manuscript -- well done!
Search Customer Reviews
Only search this product's reviews

Look for similar items by category


Feedback