会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
agang_19
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
21
22
23
24
25
26
27
28
29
···
58
下一页
2018年11月19日
设计模式 责任链模式
摘要: class Leader: def __init__(self): pass def setSuperior(self, Obj): self.superior = Obj def approval(self, day): pass class GroupLeader(Leader): def approval(s...
阅读全文
posted @ 2018-11-19 17:56 agang_19
阅读(175)
评论(0)
推荐(0)
编辑
2018年11月16日
设计模式 模版模式
摘要: class CarTemplate: def __init__(self): pass def wheel(self): return ('4个轮子,牌子是:'); def engine(self): return ('一个发动机,牌子是:') def frame(self): return ('一个...
阅读全文
posted @ 2018-11-16 14:50 agang_19
阅读(134)
评论(0)
推荐(0)
编辑
2018年11月15日
设计模式 建造者模式
摘要: class Bulider: def __init__(self): pass def wheel(self): pass def engine(self): pass def frame(self): pass def getCar(self): pass class Ca...
阅读全文
posted @ 2018-11-15 16:26 agang_19
阅读(116)
评论(0)
推荐(0)
编辑
2018年11月13日
设计模式 状态模式
摘要: class WorkState: def __init__(self): pass def work(self): pass class Monday(WorkState): def work(self, w): if w.day == 1: print('no happy') else: w.se
阅读全文
posted @ 2018-11-13 11:20 agang_19
阅读(213)
评论(0)
推荐(0)
编辑
2018年11月12日
观察者模式
摘要: class Subject: def attach(self): pass def remove(self): pass def noticefy(self): pass def getState(self): pass def setState(self): pass cl...
阅读全文
posted @ 2018-11-12 19:58 agang_19
阅读(183)
评论(0)
推荐(0)
编辑
中介者模式
摘要: class Mediator: def __init__(self): pass class CarMediator(Mediator): def setObj(self, Buyller, Seller): self.buyller = Buyller self.seller = Seller d
阅读全文
posted @ 2018-11-12 18:31 agang_19
阅读(100)
评论(0)
推荐(0)
编辑
设计模式 命令行模式
摘要: 命令行模式: 把一个个请求封装成一个个对象,加入一个invoker, command抽象命令类 ConcreteCommand具体命令类 Invoker调用者/请求者 请求的发送者,它通过命令对象来执行请求。一个调用者并不需要在设计时确定其接受者,因此它只与抽象命令之间存在关联。在程序运行时,将调用
阅读全文
posted @ 2018-11-12 11:41 agang_19
阅读(384)
评论(0)
推荐(0)
编辑
2018年11月7日
桥接模式
摘要: class Car: def __init__(self, obj): self.color = obj() def showColor(self): return self.color.show() class BMW(Car): def showColor(self): print('bmw')
阅读全文
posted @ 2018-11-07 15:03 agang_19
阅读(102)
评论(0)
推荐(0)
编辑
2018年11月6日
享元模式
摘要: 单例模式是类级别的,一个类只能有一个对象实例; 享元模式是对象级别的,可以有多个对象实例,多个变量引用同一个对象实例; 享元模式主要是为了节约内存空间,提高系统性能,而单例模式主要为了可以共享数据;
阅读全文
posted @ 2018-11-06 11:57 agang_19
阅读(157)
评论(0)
推荐(0)
编辑
代理模式
摘要: from abc import ABCMeta, abstractmethod class Card: def __init__(self): print('proxy interface') @abstractmethod def consume(self, account): pass @abstractmethod ...
阅读全文
posted @ 2018-11-06 09:47 agang_19
阅读(145)
评论(0)
推荐(0)
编辑
上一页
1
···
21
22
23
24
25
26
27
28
29
···
58
下一页
公告