Tag:Design pattern

  • Extend the design pattern to solve practical problems: the logic of decoupling parameters changing and the formula relatively stable.

    Time:2019-12-6

    In the process of numerical simulation programming, there is a problem: some parameters or physical values are obtained through various operations by other parameters or variables. If the values of these parameters and variables are constants, we will not change them once they are initialized, so the problem becomes very simple, for example: const double […]

  • Java design pattern

    Time:2019-12-3

    Design pattern classification There are five kinds of creation pattern: factory method pattern, abstract factory pattern, singleton pattern, builder pattern and prototype pattern. There are seven structural modes: adapter mode, decorator mode, agent mode, appearance mode, bridge mode, combination mode and sharing mode. There are eleven behavioral patterns: strategy pattern, template method pattern, observer pattern, […]

  • Write while reading: write an HTTP construction class based on the fetch onion like model

    Time:2019-11-18

    The first is:Personal blog: eating without washing dishes Onion model Anyone who has learned or understood the node service framework koa may have heard about the onion model and middleware. Well, it’s the onion, as shown below:Koa encapsulates HTTP through the onion model. Middleware is the onion layer by layer. Here we recommend two articles […]

  • Abstract factory mode

    Time:2019-11-16

    In order to highlight the features of the design pattern as much as possible, the sample code adopts the minimalist code. Try to avoid other code interfering with the understanding of design patterns Definition Abstract factory pattern: provides an interface to create a series of related or interdependent objects without specifying their specific classes.In short, […]

  • Appearance mode [C ×]

    Time:2019-11-15

    In order to highlight the features of the design pattern as much as possible, the sample code adopts the minimalist code. Try to avoid other code interfering with the understanding of design patterns Definition It provides a consistent interface for a group of interfaces in the subsystem. The appearance pattern defines a high-level interface, which […]

  • Design mode-03-generator mode

    Time:2019-11-8

    Generator mode Summary The generator pattern separates the construction of a complex object from its representation, so that the same construction process can create different representations. The main function of generator pattern is to build complex products, and build products step by step in detail, that is to say, generator pattern focuses on solving the […]

  • JS primary surface longitude from primary to advanced [nearly 1.5W words]

    Time:2019-11-6

    Preface It’s time to roll up the JS foundation, get familiar with it, and take the offer at ten speed;This paper is not from the traditional way of question and answer, but from the knowledge dimension, in order to form a knowledge networkIncludes functions, arrays, objects, data structures, algorithms, design patterns, and HTTP 1. function […]

  • Design mode-04-responsibility chain mode

    Time:2019-11-5

    Responsibility chain mode Summary The responsibility chain pattern is to make multiple objects have the opportunity to process the request, so as to avoid the coupling relationship between the sender and the receiver of the request. Link these objects into a chain and pass the request along the chain until there is an object to […]

  • Design mode-06-combination mode

    Time:2019-11-4

    Combination mode Summary Tree structure is often encountered in projects. It is difficult to manage when the tree structure becomes larger and larger. The composition mode allows you to combine objects into a tree structure to represent the “whole / part” hierarchy. Composition enables customers to work with individual objects and composition of objects in […]

  • Observer mode

    Time:2019-11-3

    In order to highlight the features of the design pattern as much as possible, the sample code adopts the minimalist code. Try to avoid other code interfering with the understanding of design patterns Definition Defines a one to many dependency between objects. When the state of an object changes, all objects that depend on it […]

  • Design mode-07-decorator mode

    Time:2019-11-2

    Decorator mode Summary When objects need to add some functions, such as adding validation functions to form components, adding ingredients to coffee, adding scrollbars to windows, etc. at this time, if inheritance is used, many subclasses will be generated, which is not easy to manage, and class explosion will occur when the project is growing […]

  • Proxy design pattern

    Time:2019-10-31

    Summary Before we start the text, let’s consider a question: what’s calledProxy?according toWikipediaDefinition: Proxy (English: proxy), also known as network proxy, is a special network service, which allows a network terminal (generally the client) to make indirect connection with another network terminal (generally the server) through this service. Some network devices such as gateway and […]