出版社: Addison Wesley
副标题: elements of reusable object-oriented software
出版年: 1994-10-31
页数: 416
定价: GBP 47.99
装帧: Hardcover
丛书: Addison-Wesley Professional Computing Series
ISBN: 9780201633610
内容简介 · · · · · ·
* Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselve...
* Capturing a wealth of experience about the design of object-oriented software, four top-notch designers present a catalog of simple and succinct solutions to commonly occurring design problems. Previously undocumented, these 23 patterns allow designers to create more flexible, elegant, and ultimately reusable designs without having to rediscover the design solutions themselves. * The authors begin by describing what patterns are and how they can help you design object-oriented software. They then go on to systematically name, explain, evaluate, and catalog recurring designs in object-oriented systems. With Design Patterns as your guide, you will learn how these important patterns fit into the software development process, and how you can leverage them to solve your own design problems most efficiently.
作者简介 · · · · · ·
四位作者均是国际公认的面向对象软件领域的专家。
Erich Gamma博士是瑞士苏黎士国际面向对象技术软件中心的技术主管。
Richard Helm博士是澳大利亚悉尼IBM顾问集团公司面向对象技术公司的成员。
Ralph Johnson博士是Urbana-Champaign伊利诺大学计算机科学系成员。
John Vlissides博士是位于纽约Hawthorne的IBN托马斯J.沃森研究中心的研究人员。
目录 · · · · · ·
Foreword
Guide to Readers
1. Introduction
1.1. What Is a Design Pattern?
1.2. Design Patterns in Smalltalk MVC
· · · · · · (更多)
Foreword
Guide to Readers
1. Introduction
1.1. What Is a Design Pattern?
1.2. Design Patterns in Smalltalk MVC
1.3. Describing Design Patterns
1.4. The Catalog of Design Patterns
1.5. Organizing the Catalog
1.6. How Design Patterns Solve Design Problems
1.7. How to Select a Design Pattern
1.8. How to Use a Design Pattern
2. A Case Study: Designing a Document Editor
2.1. Design Problems
2.2. Document Structure
2.3. Formatting
2.4. Embellishing the User Interface
2.5. Supporting Multiple Look-and-Feel Standards
2.6. Supporting Multiple Window Systems
2.7. User Operations
2.8. Spelling Checking and Hyphenation
2.9. Summary
Design Pattern Catalog
3. Creational Patterns
Abstract Factory
Builder
Factory Method
Prototype
Singleton
Discussion of Creational Patterns
4. Structural Patterns
Adapter
Bridge
Composite
Decorator
Facade
Flyweight
Proxy
Discussion of Structural Patterns
5. Behavioral Patterns
Chain of Responsibility
Command
Interpreter
Iterator
Mediator
Memento
Observer
State
Strategy
Template Method
Visitor
Discussion of Behavioral Patterns
6. Conclusion
6.1. What to Expect from Design Patterns
6.2. A Brief History
6.3. The Pattern Community
6.4. An Invitation
6.5. A Parting Thought
A. Glossary
B. Guide to Notation
C. Foundation Classes
Bibliography
Index
· · · · · · (收起)
丛书信息
喜欢读"Design Patterns"的人也喜欢的电子书 · · · · · ·
喜欢读"Design Patterns"的人也喜欢 · · · · · ·
Design Patterns的话题 · · · · · · ( 全部 条 )



Design Patterns的书评 · · · · · · ( 全部 88 条 )


是一本需要经常参考并不断实践的书
这篇书评可能有关键情节透露
这本书的中文版2000上年大学时就看过,后来机工出了影印版就买了一本。说实话这不是一本看完一遍就可以扔掉的书,它需要你不断实践,每次翻一下都有新的收获。 (展开)
看了30遍后至今没再看
> 更多书评 88篇
读书笔记 · · · · · ·
我来写笔记-
不加糖的黑咖啡 (迷茫的时候就想读读芒格的语录)
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链 public class UglyP...2012-12-03 17:58:45 1人喜欢
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链
public class UglyPurchasePowerHandler { private PurchaseRequest request; public UglyPurchasePowerHandler(PurchaseRequest request) { this.request = request; } public void doHandler(PurchaseRequest request) { double totalAmount = request.getAmount(); if (totalAmount <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (totalAmount > 1000 && totalAmount <= 5000) { System.out.println("your purchase request will send to director!"); } else { System.out.println("your purchase request can't be approved!"); } } public PurchaseRequest getRequest() { return request; } public void setRequest(PurchaseRequest request) { this.request = request; } }
代码里面使用分支判断,这样做的弊端就是doHandler里面处理了所有的逻辑判断,将来扩展的时候要在这里面加入,其实这里面每一个分支判断就是一个不同的流程,对应不能的角色,完全可以分开,而主流程就是调用handler并且传递。
@Override public void doHandler() { if (request.getAmount() <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (null != successorHandler) { successorHandler.doHandler(); } }
上面是一个manager角色的handler。代码调用区别见下面
public class PurchaseHandlerTest { public static void main(String[] args) { PurchaseRequest request = new PurchaseRequest(2000, "test"); UglyPurchasePowerHandler handler = new UglyPurchasePowerHandler(request); handler.doHandler(request); ////////////////////////////////////////////////// DefaultPurchaseHandler defaultHandler = new DefaultPurchaseHandler(null, request); DirectorPurchaseHandler directorHandler = new DirectorPurchaseHandler(defaultHandler, request); ManagerPurchaseHandler managerHandler = new ManagerPurchaseHandler(directorHandler, request); managerHandler.doHandler(); } }
解耦,关键是解耦,利于扩展。比如将来需要增加角色审批,加一个handler,不需要修改主业务流程。 优点:对于分支比较多的流程建议采用这种方式,加了分支后也仅仅是增加一节“链”,调用流程不会修改,这样也方便单元测试 缺点:代码量增加,增加一个handler需要增加一个类。 当handler变多时最好抽象出模版方法,减少重复代码。
回应 2012-12-03 17:58:45 -
1.1 What is a Design Pattern? Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem. 1.5 Organizing the Catalog Creational patterns concern the process of object creation. Structural patterns deal with the composition of classes or objects. Behavirial patterns characterize the ways in which classes or obj...
2022-04-21 21:49:20
1.1 What is a Design Pattern?
Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem.
1.5 Organizing the Catalog
Creational patterns concern the process of object creation.
Structural patterns deal with the composition of classes or objects.
Behavirial patterns characterize the ways in which classes or objects interact and distribure responsibility.
回应 2022-04-21 21:49:20 -
First, it shows the role that patterns can play in architexting complex system. Second, it provides a very pragmatic reference to a set of will-engineered patterns.
2022-04-21 21:46:08
-
不加糖的黑咖啡 (迷茫的时候就想读读芒格的语录)
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链 public class UglyP...2012-12-03 17:58:45 1人喜欢
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链
public class UglyPurchasePowerHandler { private PurchaseRequest request; public UglyPurchasePowerHandler(PurchaseRequest request) { this.request = request; } public void doHandler(PurchaseRequest request) { double totalAmount = request.getAmount(); if (totalAmount <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (totalAmount > 1000 && totalAmount <= 5000) { System.out.println("your purchase request will send to director!"); } else { System.out.println("your purchase request can't be approved!"); } } public PurchaseRequest getRequest() { return request; } public void setRequest(PurchaseRequest request) { this.request = request; } }
代码里面使用分支判断,这样做的弊端就是doHandler里面处理了所有的逻辑判断,将来扩展的时候要在这里面加入,其实这里面每一个分支判断就是一个不同的流程,对应不能的角色,完全可以分开,而主流程就是调用handler并且传递。
@Override public void doHandler() { if (request.getAmount() <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (null != successorHandler) { successorHandler.doHandler(); } }
上面是一个manager角色的handler。代码调用区别见下面
public class PurchaseHandlerTest { public static void main(String[] args) { PurchaseRequest request = new PurchaseRequest(2000, "test"); UglyPurchasePowerHandler handler = new UglyPurchasePowerHandler(request); handler.doHandler(request); ////////////////////////////////////////////////// DefaultPurchaseHandler defaultHandler = new DefaultPurchaseHandler(null, request); DirectorPurchaseHandler directorHandler = new DirectorPurchaseHandler(defaultHandler, request); ManagerPurchaseHandler managerHandler = new ManagerPurchaseHandler(directorHandler, request); managerHandler.doHandler(); } }
解耦,关键是解耦,利于扩展。比如将来需要增加角色审批,加一个handler,不需要修改主业务流程。 优点:对于分支比较多的流程建议采用这种方式,加了分支后也仅仅是增加一节“链”,调用流程不会修改,这样也方便单元测试 缺点:代码量增加,增加一个handler需要增加一个类。 当handler变多时最好抽象出模版方法,减少重复代码。
回应 2012-12-03 17:58:45 -
1.1 What is a Design Pattern? Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem. 1.5 Organizing the Catalog Creational patterns concern the process of object creation. Structural patterns deal with the composition of classes or objects. Behavirial patterns characterize the ways in which classes or obj...
2022-04-21 21:49:20
1.1 What is a Design Pattern?
Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem.
1.5 Organizing the Catalog
Creational patterns concern the process of object creation.
Structural patterns deal with the composition of classes or objects.
Behavirial patterns characterize the ways in which classes or objects interact and distribure responsibility.
回应 2022-04-21 21:49:20 -
First, it shows the role that patterns can play in architexting complex system. Second, it provides a very pragmatic reference to a set of will-engineered patterns.
2022-04-21 21:46:08
-
1.1 What is a Design Pattern? Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem. 1.5 Organizing the Catalog Creational patterns concern the process of object creation. Structural patterns deal with the composition of classes or objects. Behavirial patterns characterize the ways in which classes or obj...
2022-04-21 21:49:20
1.1 What is a Design Pattern?
Each pattern describes a problem which occur over and over again in our environment, and then describes the core of the solution to that problem.
1.5 Organizing the Catalog
Creational patterns concern the process of object creation.
Structural patterns deal with the composition of classes or objects.
Behavirial patterns characterize the ways in which classes or objects interact and distribure responsibility.
回应 2022-04-21 21:49:20 -
First, it shows the role that patterns can play in architexting complex system. Second, it provides a very pragmatic reference to a set of will-engineered patterns.
2022-04-21 21:46:08
-
不加糖的黑咖啡 (迷茫的时候就想读读芒格的语录)
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链 public class UglyP...2012-12-03 17:58:45 1人喜欢
责任链模式与if-else 这个模式对于繁琐的if-else判断非常好用,也比较适合写框架代码。 1、首先if-else会让代码变得丑陋,模块与流程耦合,对于复杂的判断直接影响主业务流程,不利于扩展。 2、引入链(chain)则是让模块与流程解耦,如果A不能做,就让B做,依次类推。 举个例子,对于一个公司采购的审批,比如金额在1000以内让经理审批,1000-5000之前让主管审批。。。可以用if-else写,当然也可以用责任链
public class UglyPurchasePowerHandler { private PurchaseRequest request; public UglyPurchasePowerHandler(PurchaseRequest request) { this.request = request; } public void doHandler(PurchaseRequest request) { double totalAmount = request.getAmount(); if (totalAmount <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (totalAmount > 1000 && totalAmount <= 5000) { System.out.println("your purchase request will send to director!"); } else { System.out.println("your purchase request can't be approved!"); } } public PurchaseRequest getRequest() { return request; } public void setRequest(PurchaseRequest request) { this.request = request; } }
代码里面使用分支判断,这样做的弊端就是doHandler里面处理了所有的逻辑判断,将来扩展的时候要在这里面加入,其实这里面每一个分支判断就是一个不同的流程,对应不能的角色,完全可以分开,而主流程就是调用handler并且传递。
@Override public void doHandler() { if (request.getAmount() <= 1000) { System.out.println("your purchase request will send to manager!"); } else if (null != successorHandler) { successorHandler.doHandler(); } }
上面是一个manager角色的handler。代码调用区别见下面
public class PurchaseHandlerTest { public static void main(String[] args) { PurchaseRequest request = new PurchaseRequest(2000, "test"); UglyPurchasePowerHandler handler = new UglyPurchasePowerHandler(request); handler.doHandler(request); ////////////////////////////////////////////////// DefaultPurchaseHandler defaultHandler = new DefaultPurchaseHandler(null, request); DirectorPurchaseHandler directorHandler = new DirectorPurchaseHandler(defaultHandler, request); ManagerPurchaseHandler managerHandler = new ManagerPurchaseHandler(directorHandler, request); managerHandler.doHandler(); } }
解耦,关键是解耦,利于扩展。比如将来需要增加角色审批,加一个handler,不需要修改主业务流程。 优点:对于分支比较多的流程建议采用这种方式,加了分支后也仅仅是增加一节“链”,调用流程不会修改,这样也方便单元测试 缺点:代码量增加,增加一个handler需要增加一个类。 当handler变多时最好抽象出模版方法,减少重复代码。
回应 2012-12-03 17:58:45
论坛 · · · · · ·
原版经典 | 来自Yuan Mai | 1 回应 | 2021-02-21 09:37:07 |
想买本英文版的练练英文水平 | 来自红尘陌客 | 1 回应 | 2020-09-06 16:22:23 |
这本书的其他版本 · · · · · · ( 全部9 )
-
机械工业出版社 (2000)9.1分 4106人读过
-
机械工业出版社 (2002)9.4分 309人读过
-
机械工业出版社 (2007)9.2分 146人读过
-
Pearson Education (2000)9.2分 33人读过
在哪儿借这本书 · · · · · ·
以下书单推荐 · · · · · · ( 全部 )
- 程序员最应该读的图书(原版) (hongqn)
- 軟件工程 (Milo)
- Quantitative Finance Books (海若)
- Reading Radar by ThoughtWorks (ggarlic)
- 【IT十年经典书系列】近10年来计算机专业图书50强,你读过几本? (olovebk)
谁读这本书?
二手市场
订阅关于Design Patterns的评论:
feed: rss 2.0
1 有用 网中鱼 2015-10-10 23:49:55
写得挺清楚的,但是感觉没什么收获。大部分的pattern不是自然而然就想出来了么
1 有用 Theme 2012-06-11 17:37:41
如果觉得收获不大,可以看看:addison wesley出版的applying uml and patterns - an introduction to object-oriented analysis。根据这个书做了一个图文混排编辑器,支持多columns,还是有收获的。
1 有用 黯淡蓝点 2017-08-22 11:05:10
The gang of four elevates the art of tools to a magnificent philosophical level.
0 有用 Streamline 2013-04-08 14:17:48
Currently studying the Decorator pattern (p. 179). And Decorator vs. Strategy pattern.
1 有用 uncutstone 2006-07-04 19:53:39
非常好, 读了两遍以上。学习面向对象,这本是必读书。另外就是敏捷软件开发。
0 有用 唐超旬 2021-12-26 10:17:10
公司内部培训中读完
0 有用 ブラシカ 2021-12-06 23:32:10
当历史书看是考古,当技术书看是糟粕。 果然有些事情还是上手比空谈有意义…… 不过也了解到了以前时代的软件设计,一个C 语言啥都能写,因为语言的限制还需此书研究茴字有几种写法,而如今各个语言在各自的领域不断深耕发展,当今的程序世界真的是百花齐放。
0 有用 豆捞 2021-11-25 18:31:26
原始本了
0 有用 𝙔𝙓𝙇 2021-09-12 20:55:45
我觉得代码写多了,大部分模式都能自己摸索出来。看这本书的好处在于,了解某些约定俗成的东西对看项目源码特别有帮助。(2021-09-12)
0 有用 康繆納德 2021-07-17 08:53:04
spring 2021