Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 199 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
199
Dung lượng
2,32 MB
Nội dung
[...]... Object-Oriented designpatterns frequently used around the world today We will be covering these patterns in more detail in the section ‘Categories of DesignPatterns In this book, we will take a look at a number of popular JavaScriptdesignpatterns and explore why certain patterns may be more suitable for your projects than others Remember that patterns can be applied not just to vanilla JavaScript (i.e... classes | 19 CHAPTER 9 JavaScriptDesignPatterns We are now going to explore JavaScript implementations of a number of both classical and modern designpatterns This section of the book will cover an introduction to these patterns, whilst the next section will focus on looking at some select patterns in greater detail A common question developers regularly ask is what the 'ideal' set of patterns they should... in pattern design: When writing a pattern, you do not need to be the original discoverer of the solutions being documented nor do you have to worry about your design overlapping with minor pieces of other patterns. If your design is strong enough to have broad useful applicability, it has a chance of being recognized as a proper pattern • Know the differences between patterns and design: A design pattern... 5: Writing DesignPatterns CHAPTER 6 Anti -Patterns If we consider that a pattern represents a best-practice, an anti-pattern represents a lesson that has been learned The term anti -patterns was coined in 1995 by Andrew Koenig in the November C++ Report that year, inspired by the GoF's book DesignPatterns In Koenig’s report, there are two notions of anti -patterns that are presented Anti -Patterns: •... view of other design constraints, and the consequences and trade-offs of its use Since we must eventually implement our designs, a design pattern also provides sample code to illustrate an implementation Although designpatterns describe object-oriented designs, they are based on practical solutions that have been implemented in mainstream object-oriented programming languages ” Designpatterns can... Always research thoroughly before working on new patterns however, as you may find it more beneficial to use or build on top of existing proven patterns than starting afresh 10 | Chapter 4: The Structure Of A Design Pattern CHAPTER 5 Writing DesignPatterns Although this book is aimed at those new to design patterns, a fundamental understanding of how a design pattern is written can offer you a number... 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 JavaScriptPatterns by Stoyan Stefanov Writing Maintainable JavaScript by Nicholas Zakas JavaScript: The Good Parts by Douglas Crockford... into those that do Patterns that fall under this category include: Decorator, Facade, Flyweight, Adapter and Proxy Behavioral DesignPatterns Behavioral patterns focus on improving or streamlining the communication between disparate objects in a system Some behavioral patterns include: Iterator, Mediator, Observer and Visitor 16 | Chapter 7: Categories Of Design Pattern CHAPTER 8 Design Pattern Categorization... about into the first documentation about design patterns, which was to be a guide for novice developers looking to improve their coding skills It's important to note that the concepts behind designpatterns have actually been around in the programming industry since its inception, albeit in a less formalized form One of the first and arguably most iconic formal works published on designpatterns in software... size of your codebase can be decreased • Patterns add to a developers vocabulary, which makes communication faster • Patterns that are frequently used can be improved over time by harnessing the collective experiences other developers using those patterns contribute back to the design pattern community In some cases this leads to the creation of entirely new designpatterns whilst in others it can lead . h1" alt=""
Learning JavaScript Design
Patterns
Addy Osmani
Beijing
•
Cambridge
•
Farnham
•
Köln
•
Sebastopol
•
Tokyo
Learning JavaScript Design Patterns
by. . . . . . . . . . . 15
Creational Design Patterns 15
Structural Design Patterns 16
Behavioral Design Patterns 16
8. Design Pattern Categorization . . .