The Observer Pattern The Observer is a design pattern where an object (known as a subject) maintains a list of objects depending on it (observers), automatically notifying them of any changes to state. When a subject needs to notify observers about s…
The Module Pattern Modules Modules are an integral piece of any robust application's architecture and typically help in keeping the units of code for a project both cleanly separated and organized. In JavaScript, there are several options for impleme…
The Singleton Pattern The Singleton pattern is thus known because it restricts instantiation of a class to a single object. Classically, the Singleton pattern can be implemented by creating a class with a method that creates a new instance of the cla…
In classical object-oriented programming languages, a constructor is a special method used to initialize a newly created object once memory has been allocated for it. In JavaScript, as almost everything is an object, we're most often interested in ob…
AMD - Learning JavaScript Design Patterns [Book] - O'Reilly The overall goal for the Asynchronous Module Definition (AMD) format is to provide a solution for modular JavaScript that developers can use today. It was born out of Dojo’s real world exper…
w Learning PHP Design Patterns Much of what passes as OOP misuses getters and setters, and making accesspublic to them only breaks encapsulation.…
Learning PHP Design Patterns CHAPTER 1 Algorithms handle speed of operations, and design patterns handle speed of development. 算法处理程序运行速度,设计模式处理程序开发速度.…
When you're on the way which is unknown and dangerous, just follow your mind and steer the boat. 软件模式: 设计模式.体系结构模式.分析模式.过程模式等. 体系结构模式 ANSIIEEEStd1471一200对体系结构的定义:一个系统的基本组织,表现为系统的组件.组件之间的相互关系.组件和环境之间的相互关系以及设计和进化的原则. 黑板模式 黑板模式是一种常用的架构模式,应用中的多种不同数据处理逻辑相…
The Mediator Design Pattern The Mediator is a behavioral design pattern in which objects, instead of communicating directly with each other, communicate only through a central message passing object (the Mediator). The Mediator pattern facilitates bo…
设计模式是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结,使用设计模式的目的是提高代码的可重用性,让代码更容易被他人理解,并保证代码可靠性.它是代码编制真正实现工程化. 四个关键元素:(1) Pattern Name, (2) Problem, (3) Solution, (4) Consequences. 01. Factory Method Pattern /* The product should be created by his own factory. */ Log…