- 博客(11)
- 收藏
- 关注
原创 23种设计模式之——装饰模式
1.定义Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclassing for extending functionality.动态地给一个对象添加一些额外的职责。
2017-07-29 12:34:40 349
原创 23种设计模式之——观察者模式
1.定义Define a one-to-many dependency between objects so that when one object changes state,all itsdependents are notified and updated automatically。定义对象间一种一对多的依赖关系,使得每当一个对象改变状态,则所有依赖于它的对象都会得到通知并被
2017-07-25 11:27:39 268
原创 23种设计模式之——责任链模式
1.定义Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.Chain the receiving objects and pass the request along the chain until an o
2017-07-24 23:04:52 352
原创 23种设计模式之——代理模式
1.定义Provide a surrogate or placeholder for another object to control access to it.为其他对象提供一种代理以控制对这个对象的访问。2.释义● Subject抽象主题角色抽象主题类可以是抽象类也可以是接口,是一个最普通的业务类型定义,无特殊要求。● RealSubjec
2017-07-22 15:46:37 277
原创 23种设计模式之——策略模式
1.定义Define a family of algorithms,encapsulate each one,and make them interchangeable.定义一组算法,将每个算法都封装起来,并且使它们之间可以互换。2.释义策略模式通用类图:策略模式使用的就是面向对象的继承和多态机制:● Context封装角色它也叫做上下文角色,起
2017-07-20 22:31:22 393
原创 23种设计模式之——建造者模式
1.定义Separate the construction of a complex object from its representation so that the sameconstruction process can create different representations.(将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。)2.实
2017-07-16 18:06:23 344
原创 23种设计模式之——模板方法模式
1. 定义Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.TemplateMethod lets subclasses redefine certain steps of an algorithm without changing the algorithm'sst
2017-07-16 12:46:31 482
原创 23种设计模式之——工厂方法模式
1.定义Define an interface for creating an object,but let subclasses decide which class toinstantiate.Factory Method lets a class defer instantiation to subclasses.定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂方法使一
2017-07-14 23:53:18 302
原创 设计六大原则纲要(一)
1.单一职责原则:单一职责原则的英文名称是Single Responsibility Principle,简称是SRP。对于单一职责原则,建议是接口一定要做到单一职责,类的设计尽量做到只有一个原因引起变化。注意 单一职责原则提出了一个编写程序的标准,用“职责”或“变化原因”来衡量接口或类设计得是否优良,但是“职责”和“变化原因”都是不可度量的,因项目而异,因环境而异。
2017-07-09 17:55:40 477 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人