Copyright © Addy Osmani 2012. Last updated 13 May 2012.
Learning JavaScript Design Patterns is released under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 unported license. It will be released via O'Reilly during Summer 2012 and will remain available for both free online and as a physical copy or eBook purchase for readers wishing to support the project.
Preface
Design patterns are reusable solutions to commonly occurring problems in software design. They are both exciting and a fascinating topic to explore in any programming language.
One reason for this is that they help us build upon the combined experience of many developers that came before us and ensure we structure our code in an optimized way, meeting the needs of problems we're attempting to solve.
Design patterns also provide us a common vocabulary to describe solutions. This can be significantly simpler than describing syntax and semantics when we're attempting to convey a way of structuring a solution in code form to others.
In this book we will explore applying both classical and modern design patterns to the JavaScript programming language.
Target Audience
This book is targeted at professional developers wishing to improve their knowledge of design patterns and how they can be applied to the JavaScript programming language.
Some of the concepts covered (closures, prototypal inheritance) will assume a level of basic prior knowledge and understanding. If you find yourself needing to read further about these topics, a list of suggested titles is provided for convenience.
If you would like to learn how to write beautiful, structured and organized code, I believe this is the book for you.
AcknowledgmentsI will always be grateful for the talented technical reviewers who helped review and improve this book, including those from the community at large. The knowledge and enthusiasm they brought to the project was simply amazing. The official technical reviewers tweets and blogs are also a regular source of both ideas and inspiration and I wholeheartedly recommend checking them out.
- Nicholas Zakas (http://nczonline.net, @slicknet)
- Andrée Hansson (http://andreehansson.se, @peolanha)
- Luke Smith (http://lucassmith.name, @ls_n)
- Alex Sexton (http://alexsexton.com, @slexaxton)
I would also like to thank Rebecca Murphey (http://rebeccamurphey.com, @rmurphey) for providing the inspiration to write this book and more importantly, continue to make it both available on GitHub and via O"Reilly.
Finally, I would like to thank my wonderful wife Ellie, for all of her support while I was putting together this publication.
CreditsWhilst some of the patterns covered in this book were implemented based on personal experience, many of them have been previously identified by the JavaScript community. This work is as such the production of the combined experience of a number of developers. Similar to Stoyan Stefanov's logical approach to preventing interruption of the narrative with credits (in JavaScript Patterns), I have listed credits and suggested reading for any content covered in the references section.
If any articles or links have been missed in the list of references, please accept my heartfelt apologies. If you contact me I'll be sure to update them to include you on the list.
ReadingWhilst this book is targeted at both beginners and intermediate developers, a basic understanding of JavaScript fundamentals is assumed. Should you wish to learn more about the language, I am happy to recommend the following titles:
- JavaScript: The Definitive Guide by David Flanagan
- Eloquent JavaScript by Marijn Haverbeke
- JavaScript Patterns by Stoyan Stefanov
- Writing Maintainable JavaScript by Nicholas Zakas
- JavaScript: The Good Parts by Douglas Crockford
Table Of Contents
- Introduction
- What is a Pattern?
- "Pattern"-ity Testing, Proto-Patterns & The Rule Of Three
- The Structure Of A Design Pattern
- Writing Design Patterns
- Anti-Patterns
- Categories Of Design Pattern
- Summary Table Of Design Pattern Categorization
- JavaScript Design Patterns
- Creational Pattern
- Constructor Pattern
- Singleton Pattern
- Module Pattern
- Revealing Module Pattern
- Observer Pattern
- Mediator Pattern
- Prototype Pattern
- Command Pattern
- Facade Pattern
- Factory Pattern
- Mixin Pattern
- Decorator Pattern
- Flyweight Pattern
- JavaScript MV* Patterns
- MVC Pattern
- MVP Pattern
- MVVM Pattern
- Modern Modular JavaScript Design Patterns
- AMD
- CommonJS
- ES Harmony
- Design Patterns In jQuery
- Composite Pattern
- Adapter Pattern
- Facade Pattern
- Observer Pattern
- Iterator Pattern
- Lazy Initialization
- Proxy Pattern
- Builder Pattern
- jQuery Plugin Design Patterns
- JavaScript Namespacing Patterns
- Conclusions
- References
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)