Classification of patterns
模式分类
Design patterns differ by their complexity, level of detail and scale of applicability to the entire system being designed. I like the analogy to road construction: you can make an intersection safer by either installing some traffic lights or building an entire multi-level interchange with underground passages for pedestrians.
设计模式的复杂性、详细程度和对整个设计的系统的适用范围各不相同。我喜欢与道路建设的类比:你可以通过安装一些交通信号灯或建造一个完整的多层立交桥和地下通道来使十字路口更安全。
The most basic and low-level patterns are often called idioms. They usually apply only to a single programming language.
最基本和最底层的模式通常被称为成语。它们通常仅适用于一种编程语言。
The most universal and high-level patterns are architectural patterns. Developers can implement these patterns in virtually any language. Unlike other patterns, they can be used to design the architecture of an entire application.
最通用和高级的模式是体系结构模式。开发人员几乎可以用任何语言实现这些模式。与其他模式不同,它们可用于设计整个应用程序的体系结构。
In addition, all patterns can be categorized by their intent, or purpose. This book covers three main groups of patterns:
此外,所有模式都可以按其意图或目的进行分类。本书涵盖三大类模式:
Creational patterns provide object creation mechanisms that increase flexibility and reuse of existing code.
创建模式提供了对象创建机制,可提高现有代码的灵活性和重用性。Structural patterns explain how to assemble objects and classes into larger structures, while keeping these structures flexible and efficient.
结构模式解释了如何将对象和类组合成更大的结构,同时保持这些结构的灵活性和效率。Behavioral patterns take care of effective communication and the assignment of responsibilities between objects.
行为模式负责对象之间的有效沟通和责任分配。