Muutke küpsiste eelistusi

Learning JavaScript Design Patterns [Pehme köide]

  • Formaat: Paperback / softback, 150 pages
  • Ilmumisaeg: 30-Aug-2012
  • Kirjastus: O'Reilly Media
  • ISBN-10: 1449331815
  • ISBN-13: 9781449331818
Teised raamatud teemal:
  • Pehme köide
  • Hind: 58,59 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 150 pages
  • Ilmumisaeg: 30-Aug-2012
  • Kirjastus: O'Reilly Media
  • ISBN-10: 1449331815
  • ISBN-13: 9781449331818
Teised raamatud teemal:
If you want to write beautiful, structured, and maintainable JavaScript code, this guide shows you how to apply both classical and modern design patterns to the language. The patterns in this book provide reusable code solutions to common problems in software design, and give you a shared vocabulary for describing solutions to others. You'll explore several popular design patterns in plain JavaScript as well as jQuery and other abstracted libraries. If you're familiar with concepts such as closures and prototypal inheritance, you'll be able to determine why some patterns may be more suitable for your projects than others. Learn the structure of design patterns and how they're written Examine basic pattern categories: creational, structural, behavioral, and anti-patterns Get the basics of 15 JavaScript implementations of classical and modern design patterns Dive into several popular JavaScript patterns in greater detail - including some less frequently used Discover what design patterns look like when implemented with jQuery Explore three formats for writing modular JavaScript: AMD, CommonJS, and Harmony Learn popular design patterns for jQuery plugins
Preface ix
1 Introduction
1(2)
2 What Is a Pattern?
3(4)
We Already Use Patterns Every Day
4(3)
3 "Pattern"-ity Testing, Proto-Patterns, and the Rule of Three
7(2)
4 The Structure of a Design Pattern
9(2)
5 Writing Design Patterns
11(2)
6 Anti-Patterns
13(2)
7 Categories of Design Patterns
15(2)
Creational Design Patterns
15(1)
Structural Design Patterns
16(1)
Behavioral Design Patterns
16(1)
8 Design Pattern Categorization
17(4)
A Brief Note on Classes
17(4)
9 JavaScript Design Patterns
21(88)
The Constructor Pattern
22(4)
Object Creation
22(2)
Basic Constructors
24(1)
Constructors with Prototypes
25(1)
The Module Pattern
26(11)
Object Literals
26(1)
The Module Pattern
27(5)
Module Pattern Variations
32(5)
The Revealing Module Pattern
37(2)
Advantages
38(1)
Disadvantages
38(1)
The Singleton Pattern
39(3)
The Observer Pattern
42(17)
Differences Between the Observer and Publish/Subscribe Pattern
46(2)
Advantages
48(1)
Disadvantages
49(1)
Publish/Subscribe Implementations
49(10)
The Mediator Pattern
59(10)
Basic Implementation
60(1)
Advanced Implementation
61(5)
Example
66(2)
Advantages and Disadvantages
68(1)
Mediator Versus Observer
68(1)
Mediator Versus Facade
68(1)
The Prototype Pattern
69(3)
The Command Pattern
72(2)
The Facade Pattern
74(3)
Notes on Abstraction
76(1)
The Factory Pattern
77(4)
When to Use the Factory Pattern
80(1)
When Not to Use the Factory Pattern
80(1)
Abstract Factories
80(1)
The Mixin Pattern
81(1)
Subclassing
81(2)
Mixins
83(3)
Advantages and Disadvantages
86(1)
The Decorator Pattern
86(4)
Pseudoclassical Decorators
90(4)
Interfaces
90(1)
Abstract Decorators
91(3)
Decorators with jQuery
94(2)
Advantages and Disadvantages
96(1)
Flyweight
96(13)
Using Flyweights
97(1)
Flyweights and Sharing Data
97(1)
Implementing Classical Flyweights
98(3)
Converting Code to Use the Flyweight Pattern
101(2)
A Basic Factory
103(1)
Managing the Extrinsic States
104(1)
The Flyweight Pattern and the DOM
105(4)
10 JavaScript MV* Patterns
109(30)
MVC
109(1)
Smalltalk-80 MVC
109(1)
MVC for JavaScript Developers
110(8)
Models
111(2)
Views
113(2)
Controllers
115(1)
Controllers in Another Library (Spine.js) Versus Backbone.js
116(2)
What Does MVC Give Us?
118(1)
Smalltalk-80 MVC in JavaScript
118(1)
Delving Deeper
119(1)
Summary
119(1)
MVP
119(4)
Models, Views, and Presenters
120(1)
MVP or MVC?
121(1)
MVC, MVP, and Backbone.js
121(2)
MVVM
123(7)
History
124(1)
Model
125(1)
View
125(3)
ViewModel
128(2)
Recap: The View and the ViewModel
130(1)
Recap: The ViewModel and the Model
130(1)
Pros and Cons
130(1)
Advantages
130(1)
Disadvantages
130(1)
MVVM with Looser Data Bindings
131(4)
MVC Versus MVP Versus MVVM
135(1)
Backbone.js Versus KnockoutJS
136(3)
11 Modern Modular JavaScript Design Patterns
139(26)
A Note on Script Loaders
140(1)
AMD
140(10)
Getting Started with Modules
141(3)
AMD Modules with Dojo
144(1)
AMD Module Design Patterns (Dojo)
145(2)
AMD Modules with jQuery
147(2)
AMD Conclusions
149(1)
CommonJS
150(3)
Getting Started
150(1)
Consuming Multiple Dependencies
151(1)
Loaders and Frameworks that Support CommonJS
151(1)
Is CommonJS Suitable for the Browser?
152(1)
Related Reading
152(1)
AMD and CommonJS: Competing, but Equally Valid Standards
153(5)
UMD: AMD and CommonJS-Compatible Modules for Plug-ins
153(5)
ES Harmony
158(4)
Modules with Imports and Exports
159(1)
Modules Loaded from Remote Sources
160(1)
Module Loader API
160(1)
CommonJS-like Modules for the Server
160(1)
Classes with Constructors, Getters, and Setters
161(1)
ES Harmony Conclusions
162(1)
Related Reading
162(1)
Conclusions
162(3)
12 Design Patterns in jQuery
165(14)
The Composite Pattern
165(1)
The Adapter Pattern
166(2)
The Facade Pattern
168(2)
The Observer Pattern
170(3)
The Iterator Pattern
173(1)
Lazy Initialization
174(2)
The Proxy Pattern
176(1)
The Builder Pattern
177(2)
13 jQuery Plug-in Design Patterns
179(44)
Patterns
180(1)
A Lightweight Start Pattern
181(2)
Complete Widget Factory Pattern
183(2)
Nested Namespacing Plug-in Pattern
185(2)
Custom Events Plug-in Pattern (with the Widget Factory)
187(2)
Prototypal Inheritance with the DOM-to-Object Bridge Pattern
189(2)
jQuery UI Widget Factory Bridge Pattern
191(2)
jQuery Mobile Widgets with the Widget Factory
193(3)
RequireJS and the jQuery UI Widget Factory
196(3)
Usage
198(1)
Globally and Per-Call Overridable Options (Best Options Pattern)
199(1)
A Highly Configurable and Mutable Plug-in Pattern
200(3)
What Makes a Good Plug-in Beyond Patterns?
203(1)
Quality
203(1)
Code Style
203(1)
Compatibility
203(1)
Reliability
203(1)
Performance
204(1)
Documentation
204(1)
Likelihood of maintenance
204(1)
Conclusions
204(1)
Namespacing Patterns
205(1)
Namespacing Fundamentals
205(10)
Single Global Variables
205(1)
Prefix Namespacing
206(1)
Object Literal Notation
206(4)
Nested Namespacing
210(1)
Immediately Invoked Function Expressions (IIFE)s
211(2)
Namespace Injection
213(2)
Advanced Namespacing Patterns
215(8)
Automating Nested Namespacing
215(2)
Dependency Declaration Pattern
217(1)
Deep Object Extension
218(3)
Recommendation
221(2)
14 Conclusions
223(2)
Appendix: References 225(4)
Index 229
Addy Osmani is a writer, speaker, and a JavaScript developer. He is a member of the jQuery core [ Bug Triage/Docs/Learning] teams where helps with bugs, documentation, and developer evangelism. When not working at AOL his personal OS projects include jQuery UI Bootstrap and TodoMVC, which help developers compare JavaScript MVC frameworks. Addy is the author of the popular ebook, Essential JavaScript Design Patterns. His personal blog is http://addyosmani.com/blog/