Giter Club home page Giter Club logo

design-pattern-gizmo's Introduction

design-pattern-gizmo

一个简单的设计模式小库,用以存放在学习设计模式中产生的代码。

*学习书籍基于《Head First 设计模式》

一 策略模式

定义:策略模式定义了算法族,使得算法的变化独立于使用算法的客户。
设计原则:针对接口编程,而非针对实现。
                  多用组合,少用继承。

代码:策略模式
类图:
策略模式类图

二 观察者模式

定义:观察者模式定义了对象之间的一对多依赖,这样,当对象状态改变时,他的所有依赖者都会得到通知并自动更新。
设计原则:应该致力于实现松耦合设计。
代码:观察者模式
类图:
观察者模式类图

三 装饰者模式

定义:装饰者模式动态的将责任附加到对象上。
设计原则:类应该对扩展开放,对修改关闭。
代码:
类图:装饰者模式
装饰者模式

design-pattern-gizmo's People

Contributors

chenworkspace avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.