Java8设计模式
Explaining design patterns
解释设计模式
Design patterns are sets of solutions to common design problems that occur over and over
设计模式是对反复出现的常见设计问题的一组解决方案
in development. They work as a solution template in which an abstract solution for a
正在开发中。它们用作解决方案模板,其中
common problem is described and the user then applies it, adapting it to their problem. In
描述了常见问题,然后用户应用它,使其适应他们的问题。在
object-oriented programming, the design pattern provides a way to design reusable classes
面向对象编程中,设计模式提供了一种设计可重用类的方法
and objects for a specific problem as well as defining the relationship between objects and
以及定义对象与对象之间的关系
classes. In addition, design patterns provide a common idiom among programming
类。此外,设计模式在编程中提供了一种常见的习惯用法
languages that allows architects and software developers to communicate about a common
允许架构师和软件开发人员就
and recurring problem regardless of the programming language they are using. With this,
以及反复出现的问题,而不管他们使用的是哪种编程语言。有了这个,
we are able to identify a problem and its solution by the name of the pattern and thinking
我们能够通过模式和思维的名称来识别问题及其解决方案
about a solution by a model point of view in a high abstraction level of language
从一个高抽象层次的语言模型的角度讨论一个解决方案
programming details.
编程细节。
The design patterns theme gained strength in 1994 after the Gang of Four (formed by Rich
1994年“四人帮”(Rich组建)之后,设计模式主题获得了发展
Gamma, Richard Helm, Ralph Johnson, and John Vlissides) wrote Design Patterns: Elements
Gamma、richardhelm、Ralph Johnson和johnvlissides)撰写了设计模式:元素
of Reusable Object‐Oriented Software. Here, they described 23 design patterns that were later
可重用的面向对象软件。后来在这里描述了23种模式
known as GoF design patterns and are still used today.
被称为GoF设计模式,至今仍在使用。
重点词汇
-
over and over 转来转去 ; 〔美〕反反复复
-
as well as 既…又… ; 除…之外 ; 此外
-
In addition 另外;加之;除…之外
-
regardless of 不管 ; 不顾 ; 不理会
-
programming language 编程语言
-
by the name of 名叫…;以…为名
Explaining the Gang of Four design patterns
解释四人帮设计模式
The Gang of Four (GoF) design patterns are 23 patterns that are classified as creational patterns
四人帮(GoF)设计模式是23种被归类为创造性的模式structural patterns, and behavioral patterns. The creational patterns control the
结构模式和行为模式。创造模式控制着
creation and initialization of the object and class selection; the structural patterns define the
对象和类选择的创建和初始化;结构模式定义
relationship between classes and objects, and the behavioral patterns control the
类和对象之间的关系,以及行为模式控制
communication and interaction between objects. As well as this, the GoF design patterns
对象之间的通信和交互。除此之外,GoF的设计模式
have two types of scope which defi