![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
design pattern
together_2008
这个作者很懒,什么都没留下…
展开
-
Visitor
Objective: keep the code structure, extend the function by adding visitor. it is follow the principle of Software entities should be open for extension,but closed for modification. famous imple原创 2010-05-28 22:41:00 · 332 阅读 · 0 评论 -
Singleton
Objective: prevent the class is created and destroied frequently, improve the performent. public class Singleton{private singleton(){} private static Singleton; public static Singleton g原创 2010-05-28 23:11:00 · 211 阅读 · 0 评论 -
Decorator
顾名思义,就是装修.给房子装修的话就得把原有功能封装一下,暖气啥的包一层,厨房弄个整体橱柜,看起来漂亮.还得在原有功能上加点啥,比如说厕所装个浴霸,洗澡就暖和了,卧室凿个壁橱,多个家具功能. 这也就是这个设计模式的本质. 例子呈上: 1. interfact or abstract classpublic interface room{ public void r原创 2010-05-30 17:11:00 · 242 阅读 · 0 评论 -
adaptor
just like the socket adaptor, we need it to make the old socket works for current facility. Classic example: public class MyCircle{public void displayCircle(){ System.out.print("Circle原创 2010-05-28 23:42:00 · 243 阅读 · 0 评论 -
Factory
just like the factory in real life. Factory produce the production. That is the objects is created by one middle layer class. Sample: public class ClothFacotry{ public enum clothType原创 2010-05-30 15:38:00 · 240 阅读 · 0 评论