Mastering JavaScript Design Patterns
β Scribed by Timms, Simon
- Publisher
- Packt Publishing
- Year
- 2014
- Tongue
- English
- Leaves
- 290
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
Enhance your JavaScript code with this essential collection of design patterns. Discover an extensive range of techniques and strategies to successfully tackle complex JavaScript development problems and put them into practice by following detailed examples that demonstrate each design pattern at its most effective. Dive deeper into JavaScript and master these powerful design patterns for an innovative and cutting-edge approach to JavaScript that meets the demands of modern web development.Explore how design patterns can help you improve your JavaScript code and get to grips with creational, structural behavioural patterns, as you discover how to put them to work in different scenarios. Then look deeper at patterns used in functional programming, as well as model view patterns, and patterns to build web applications. You will also find patterns to improve the testability of your code using mock objects, mocking frameworks and monkey patching along with some advanced patterns including dependency injection and live postprocessing.Taking a complete and journey through the most valuable design patterns, and providing clear guidance on how to effectively use them in JavaScript, this JavaScript book gives you access to one of the best ways to learn JavaScript and use it to meet the demands of web development today.Discover and use tried and tested design patterns for a more effective approach to JavaScriptLearn simple strategies for improving your code organizationGet to grips with creational, behavioural and structural design patternsRethink and revitalize your code with the use of functional patternsHarness the power of design patterns for a range of development tasks from building an application to code testingExplore advanced JavaScript design patterns including dependency injection
β¦ Table of Contents
Cover......Page 1
Copyright......Page 3
Credits......Page 4
About the Author......Page 5
About the Reviewers......Page 6
www.PacktPub.com......Page 9
Table of Contents......Page 14
Preface......Page 20
The road to JavaScript......Page 26
The early days......Page 27
The way of Gmail......Page 29
JavaScript everywhere......Page 32
What is a design pattern?......Page 35
Antipatterns......Page 37
Summary......Page 39
Chunks of code......Page 42
What's the matter with global scope anyway?......Page 44
Objects in JavaScript......Page 46
Build me a prototype......Page 50
Inheritance......Page 53
Modules......Page 55
ECMAScript 6 classes and modules......Page 59
Summary......Page 60
Chapter 3: Creational Patterns......Page 62
Abstract Factory......Page 63
Implementation......Page 68
Builder......Page 70
Implementation......Page 71
Implementation......Page 74
Singleton......Page 77
Implementation......Page 78
Prototype......Page 79
Implementation......Page 80
Hints and tips......Page 81
Summary......Page 82
Adapter......Page 84
Implementation......Page 86
Bridge......Page 88
Implementation......Page 90
Composite......Page 93
An example......Page 94
Implementation......Page 95
Decorator......Page 97
Implementation......Page 98
FaΓ§ade......Page 99
Implementation......Page 100
Implementation......Page 102
Proxy......Page 104
Implementation......Page 105
Summary......Page 106
Chapter 5: Behavioral Patterns......Page 108
Chain of responsibility......Page 109
Implementation......Page 110
Command......Page 113
The command message......Page 114
The invoker......Page 116
The receiver......Page 117
An example......Page 118
Implementation......Page 119
Implementation......Page 120
Mediator......Page 122
Implementation......Page 123
Memento......Page 124
Implementation......Page 125
Observer......Page 128
Implementation......Page 129
State......Page 131
Implementation......Page 132
Strategy......Page 135
Implementation......Page 136
Template method......Page 138
Implementation......Page 140
Visitor......Page 142
Summary......Page 147
Chapter 6: Functional Programming......Page 150
Function passing......Page 151
Implementation......Page 153
Filters and pipes......Page 155
Implementation......Page 156
Accumulators......Page 158
Implementation......Page 159
Memoization......Page 160
Implementation......Page 161
Immutability......Page 163
Implementation......Page 164
Hints and tips......Page 166
Summary......Page 167
Chapter 7: Model View Patterns......Page 168
Model View Controller......Page 169
The MVC code......Page 174
Model View Presenter......Page 179
The MVP code......Page 180
Model View ViewModel......Page 183
The MVVM code......Page 184
A better way to transfer changes between the model and the view......Page 186
Observing view changes......Page 188
Summary......Page 189
Sending JavaScript......Page 190
Combining files......Page 191
Minification......Page 194
Content delivery networks......Page 195
jQuery......Page 196
d3......Page 198
Doing two things at once β multithreading......Page 201
The circuit breaker pattern......Page 204
Back-off......Page 205
Degraded application behavior......Page 206
The promise pattern......Page 207
Summary......Page 209
Chapter 9: Messaging Patterns......Page 210
What's a message anyway?......Page 211
Commands......Page 212
Events......Page 213
Request-reply......Page 215
Publish-subscribe......Page 218
Fan out and fan in......Page 221
Dead-letter queues......Page 224
Message replay......Page 226
Pipes and filters......Page 227
Versioning messages......Page 228
Hints and tips......Page 229
Summary......Page 230
Chapter 10: Patterns for Testing......Page 232
Test in the small with unit tests......Page 233
Arrange-Act-Assert......Page 235
Asserts......Page 236
Fake objects......Page 237
Test spies......Page 238
Stub......Page 239
Mock......Page 241
Monkey patching......Page 242
Browser testing......Page 243
Faking the DOM......Page 244
Wrapping the manipulation......Page 245
Hints and tips......Page 246
Summary......Page 247
Dependency injection......Page 248
Live postprocessing......Page 252
Aspect-oriented programming......Page 253
Macros......Page 257
Hints and tips......Page 258
Summary......Page 259
TypeScript......Page 260
The class syntax......Page 261
The module syntax......Page 262
Arrow functions......Page 263
Typing......Page 265
Traceur......Page 267
Classes......Page 268
Default parameters......Page 269
Template literals......Page 270
Block bindings with let......Page 271
Async......Page 273
Hints and tips......Page 274
Summary......Page 275
Appendix: Conclusion......Page 276
Index......Page 280
β¦ Subjects
Computer Science;Programming
π SIMILAR VOLUMES
<p><b>Discover how to use JavaScript design patterns to create powerful applications with reliable and maintainable code</b></p> <h2>About This Book</h2><ul><li>Learn how to use tried and true software design methodologies to enhance your Javascript code</li><li>Discover robust JavaScript implementa
Take the most popular JavaScript design patterns for a spin and write reliable and maintainable codeAbout This Book*This book covers all the new object-oriented and functional capabilities introduced in ECMAScript-2015*Learn how to use tried and true software design methodologies to enhance your Jav
Key Features Learn how to use tried and true software design methodologies to enhance your Javascript code Discover robust JavaScript implementations of classic as well as advanced design patterns Packed with easy-to-follow examples that can be used to create reusable code and extensible designs Boo