随笔分类 - HeadFisrt设计模式学习笔记
摘要:一、 1.The Proxy Pattern provides a surrogate or placeholder for another object to control access to it. Your client object acts like it’s making remote
阅读全文
摘要:一、使用步骤 1.generate stubs and skeletons:Run rmic on the remote implementation class 如:D:\Workspaces\MyEclipse10\HeadFirstDesignPattern\bin>rmic headfirs
阅读全文
摘要:一、 1. 2.The State Pattern allows an object to alter its behavior when its internal state changes. The object will appear to change its class. 3.The St
阅读全文
摘要:一、 1.The Composite Pattern allows us to build structures of objects in the form of trees that contain both compositions of objects and individual obje
阅读全文
摘要:一、 1.迭代器模式是对遍历集合元素的抽象 2.The Iterator Pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying
阅读全文
摘要:一、 1.The Template Method defines the steps of an algorithm and allows subclasses to provide the implementation for one or more steps. 2.The Template M
阅读全文
摘要:一、 1. 2.The Adapter Pattern converts the interface of a class into another interface the clients expect. Adapter lets classes work together that could
阅读全文
摘要:一、 1.因为是操作经常变化,所以封装操作为command对象。You can do that by introducing “command objects” into your design. A command object encapsulates a request to do somet
阅读全文
摘要:一、 1.The Singleton Pattern ensures a class has only one instance, and provides a global point of access to it. 2. 3. 二、例子一:线程不安全 1 package headfirst.d
阅读全文
摘要:一、 1.The Facade Pattern provides a unifi ed interface to a set of interfaces in a subsytem. Facade defi nes a higher-level interface that makes the su
阅读全文
摘要:一、 1."工厂模式"不是种真正的设计模式,而是一种编程术语 2.The Factory Method Pattern defi nes an interface for creating an object, but lets subclasses decide which class to in
阅读全文
摘要:一、 1.The Decorator Pattern attaches additional responsibilities to an object dynamically.Decorators provide a fl exible alternative to subclassing for
阅读全文
摘要:一、什么是观察者模式 观察者模式定义了一系列对象间一对多的关系,当主题对象的状态发生变化时,会通知所有观察者 二、自定义观察模式 1. 2. 1 package headfirst.designpatterns.observer.weather; 2 3 public interface Subje
阅读全文
摘要:什么是策略模式:它定义了一系列算法,可以根据不同的实现调用不同的算法 大多数的设计模式都是为了解决系统中变化部分的问题 一、OO基础 抽象、封装、多态、继承 二、OO原则 1.封装变化,如把FlyBehavious、QuackBehavior从Duck中抽离出来 2.组合优于继承 3.面向抽象(接口
阅读全文

浙公网安备 33010602011771号