Related Titles
- Full Description
-
As a web developer, youll 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 unlockedJavaScript is capable of full objectoriented 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, youll start with the basics of objectoriented programming in JavaScript applicable to design patterns, including making JavaScript more expressive, inheritance, encapsulation, information hiding, and more. With that covered, you can kickstart your JavaScript development in the second part of the book, where youll 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 realworld 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 youll discover how to create your own libraries and APIs for even more efficient coding.
- Master the basics of objectoriented programming in JavaScript, as they apply to design patterns
- Apply design patterns to your kickstart your JavaScript development
- Work through several realworld examples
What youll learn
- How to apply objectoriented programming techniques in JavaScript
- How to take advantage of inheritance, interfaces, and encapsulation and information hiding to kickstart 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
-
Table of Contents
- Expressive JavaScript
- Interfaces
- Encapsulation and Information Hiding
- Inheritance
- The Singleton Pattern
- Chaining
- The Factory Pattern
- The Bridge Pattern
- The Composite Pattern
- The Facade Pattern
- The Adapter Pattern
- The Decorator Pattern
- The Flyweight Pattern
- The Proxy Pattern
- The Observer Pattern
- The Command Pattern
- The Chain of Responsibility Pattern
- Source Code/Downloads
- Errata
-
If you think that you've found an error in this book, please let us know about it. You will find any confirmed erratum below, so you can check if your concern has already been addressed.
On page 89:I found a couple of errors with the callback/chaining example:
window.API = window.API || {};
Should be changed to
window.API = window.API || function(){};
API should be a function instead of an object; otherwise you'll get an error once you try to instantiate a new instance of the API class.
Also the 2 privileged methods (setName and getName) should be wrapped in a return statement.
Same 2 problems with the API2 class.
Also, one suggestion for readability would be to not omit the optional parenthesis when instantiating a new API and API2 object.
e.g., var o = new API();








