首页 > 其他分享 >序) 设计模式参考资料

序) 设计模式参考资料

时间:2023-06-09 13:45:53浏览次数:46  
标签:instance object patterns objects design 设计模式 参考资料 class

https://sourcemaking.com/design_patterns

http://javapapers.com/design-patterns/

 

 

Design Patterns

In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.

Uses of Design Patterns

Design patterns can speed up the development process by providing tested, proven development paradigms. Effective software design requires considering issues that may not become visible until later in the implementation. Reusing design patterns helps to prevent subtle issues that can cause major problems and improves code readability for coders and architects familiar with the patterns.

Often, people only understand how to apply certain software design techniques to certain problems. These techniques are difficult to apply to a broader range of problems. Design patterns provide general solutions, documented in a format that doesn't require specifics tied to a particular problem.

In addition, patterns allow developers to communicate using well-known, well understood names for software interactions. Common design patterns can be improved over time, making them more robust than ad-hoc designs.

Creational design patterns

These design patterns are all about class instantiation. This pattern can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, object-creation patterns use delegation effectively to get the job done.

  • Abstract Factory Creates an instance of several families of classes
  • Builder Separates object construction from its representation
  • Factory Method Creates an instance of several derived classes
  • Object Pool Avoid expensive acquisition and release of resources by recycling objects that are no longer in use
  • Prototype A fully initialized instance to be copied or cloned
  • Singleton A class of which only a single instance can exist

Structural design patterns

These design patterns are all about Class and Object composition. Structural class-creation patterns use inheritance to compose interfaces. Structural object-patterns define ways to compose objects to obtain new functionality.

  • Adapter Match interfaces of different classes
  • Bridge Separates an object’s interface from its implementation
  • Composite A tree structure of simple and composite objects
  • Decorator Add responsibilities to objects dynamically
  • Facade A single class that represents an entire subsystem
  • Flyweight A fine-grained instance used for efficient sharing
  • Private Class Data Restricts accessor/mutator access
  • Proxy An object representing another object

Behavioral design patterns

These design patterns are all about Class's objects communication. Behavioral patterns are those patterns that are most specifically concerned with communication between objects.

  • Chain of responsibility  A way of passing a request between a chain of objects
  • Command Encapsulate a command request as an object
  • Interpreter A way to include language elements in a program
  • Iterator Sequentially access the elements of a collection
  • Mediator Defines simplified communication between classes
  • Memento Capture and restore an object's internal state
  • Null Object Designed to act as a default value of an object
  • Observer A way of notifying change to a number of classes
  • State Alter an object's behavior when its state changes
  • Strategy Encapsulates an algorithm inside a class
  • Template method Defer the exact steps of an algorithm to a subclass
  • Visitor Defines a new operation to a class without change

标签:instance,object,patterns,objects,design,设计模式,参考资料,class
From: https://www.cnblogs.com/zno2/p/6963656.html

相关文章

  • 设计模式系列 | 建造者模式
    很多人也都听说过建造者设计模式,但总是对这个设计模式理解得不够透彻,今天我们就来聊聊建造者设计模式。另外也说说建造者设计模式和工厂模式的区别。定义其实建造者设计模式的定义,很多事看不懂的,也是记不住的,但我们还是得先来看看是如何定义的。TheintentoftheBuilderdesignp......
  • 转载:Spring 框架的设计理念与设计模式分析
    Spring框架的设计理念与设计模式分析<!--LEADSPACE_BODY_END--><!--SUMMARY_BEGIN-->Spring作为现在最优秀的框架之一,已被广泛的使用,并且有很多对其分析的文章。本文将从另外一个视角试图剖析出Spring框架的作者设计Spring框架的骨骼架构的设计理念,有那几个核心组件?为......
  • 单例这种设计模式
    随着我们编写代码的深入,我们或多或少都会接触到设计模式,其中单例(Singleton)模式应该是我们耳熟能详的一种模式。本文将比较特别的介绍一下Java设计模式中的单例模式。概念单例模式,又称单件模式或者单子模式,指的是一个类只有一个实例,并且提供一个全局访问点。实现思路在单例的类中......
  • 使用c#实现23种设计模式
    使用c#实现23种常见的设计模式设计模式通常分为三个主要类别:创建型模式结构型模式行为型模式。这些模式是用于解决常见的对象导向设计问题的最佳实践。以下是23种常见的设计模式并且提供c#代码案例:创建型模式:1.单例模式(Singleton)publicsealedclassSingleton......
  • Python设计模式-01工厂模式
    工厂模式工厂模式(FactoryPattern)是一种创建型设计模式,它提供了一种创建对象的最佳方式,而无需指定将要创建的对象的确切类。工厂模式通过定义一个工厂接口来创建对象,让子类决定实例化哪个类。这样可以将对象的创建与使用分离,从而降低系统的耦合度。工厂模式包含三种角色:具体工......
  • Java设计模式-适配器模式
    适配器模式(AdapterPattern)是一种常见的设计模式,它主要用于在不改变现有系统结构的情况下,将一个类的接口转换成客户端所期望的另一个接口。在本文中,我们将介绍适配器模式的基本概念、实现方法以及优缺点,并探讨适配器模式在Java编程语言中的具体应用。简介适配器模式是一种结构型......
  • 转:使用c#实现23种常见的设计模式
    转自:https://www.cnblogs.com/hejiale010426/archive/2023/06/05/17457761.html设计模式通常分为三个主要类别:创建型模式结构型模式行为型模式这些模式是用于解决常见的对象导向设计问题的最佳实践。以下是23种常见的设计模式并且提供c#代码案例:1.创建型模式1.1单例模......
  • 小话设计模式
    设计模式1关系......
  • 设计模式目录
    目录抽象工厂模式代理模式单例模式工厂模式......
  • C++设计模式:观察者模式
    观察者模式又叫做发布-订阅模式;观察者模式定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象。这个主题对象在状态发生变化时,会通知所有观察者对象,使他们能够自动的更新自己。有两大类(主题和观察者)一共四个角色从上面我们可以看到,这里面包含了:(1)抽象主题/抽象......