Giter Club home page Giter Club logo

java-design's Introduction

javadesign

java设计模式

1.producer-consumer(生产者/消费者模式)

(注:生产者消费者模式并不是GOF提出的23种设计模式之一,23种设计模式都是建立在面向对象的基础之上的,但其实面向过程的编程中也有很多高效的编程模式,生产者消费者模式便是其中之一,它是我们编程过程中最常用的一种设计模式。)

2.singleton(单例模式)

单例模式一般分为五种 懒汉,恶汉,双重校验锁,枚举和静态内部类

3.command(命令模式)

命令模式结构:

  • 1.命令请求者
  • 2.命令, 设计为接口
  • 3.具体命令,实现命令接口, 实现具体命令
  • 4.命令接收者

4.observer(观察者模式,观察者模式主要用于一对多案例)

观察者模式:

  • 1.主题接口,定义基本主题操作,比如添加观察者,通知观察者
  • 2.具体主题,主题接口的具体实现
  • 3.观察者接口,定义观察者接收主题消息的接口
  • 4.具体观察者,定义观察者具体从主题中心获取何种数据

观察者模式分为推拉两种模式,推模式表现在主题主动推送数据给观察者,拉模式表现在观察者从主题中心拉取数据库

5.wrapper(装饰模式)

java-design's People

Contributors

followwwind avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

jqmtony zmx456

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.