Tag:architect

  • PHP design pattern adapter mode code examples (10)

    Time:2020-12-15

    objective By converting the interface of one class to another for compatibility, the adapter enables classes that could not be used together because of different interfaces to work together. The adapter provides a compatible interface to the user by converting the original interface. example Client database adapter Use multiple different network services and adapters to […]

  • PHP design patterns composite code examples (12)

    Time:2020-12-14

    objective A group of objects is treated the same way as a single instance of that object. Examples The instance of the form class contains multiple child elements, and it also responds to the request of render() like a single child element. When the render() method is called, it will traverse all the child elements […]

  • Bridge code examples of PHP design patterns (11)

    Time:2020-12-13

    objective Decoupling an object separates the abstraction from the implementation so that they can be changed independently. example The official PHP advanced learning exchange community “click” manages and sorts out some materials. Bat and other first-line factories have advanced knowledge systems (related learning materials and written test questions) and are not limited to: distributed architecture, […]

  • Big data mapping pattern of PHP (13)

    Time:2020-12-11

    target Data mapper is a kind of data access layer, which is used to transfer data between persistent data store (usually a relational database) and in memory data representation (domain layer). The goal of this pattern is to separate the memory representation, persistent storage and data access of data. This layer consists of one or […]

  • Decorator code examples of PHP design patterns (14)

    Time:2020-12-10

    objective Dynamically add functionality to instances of a class example Zend Framework: Zend_ Form_ Decorator of element instance Web service layer: JSON and XML decorators for rest services (only one of them can be used here, of course) UML diagram The official PHP advanced learning exchange community “click” manages and sorts out some materials. Bat […]

  • Dependency injection code examples of PHP design patterns (15)

    Time:2020-12-9

    objective A loosely coupled software architecture is implemented to get better code for testing, management and extension Dependency injection pattern: dependency injection is an implementation of inversion of control. To achieve inversion of control, the usual solution is to leave the creation of the callee instance to the IOC container, and then inject the callee […]

  • Facade code examples of PHP design patterns (16)

    Time:2020-12-6

    objective The original purpose of facade pattern is not to prevent you from reading complex API documents, it is just a side effect. In fact, it is intended to reduce coupling and follow Demeter’s law. Facade decouples visitors and subsystems by embedding multiple (and sometimes only one) interfaces, while reducing complexity. Facade will not prohibit […]

  • Flyweight code examples of PHP design patterns (18)

    Time:2020-12-5

    objective In order to save memory use, share mode will try to make similar objects share memory. This is necessary when a large number of similar objects are used. The common practice is to save the state of similar objects in the external data structure and pass them to the sharing meta object when necessary. […]

  • PHP design patterns registry code examples (20)

    Time:2020-12-4

    objective The goal is to be able to store object instances that are often used in applications, and are usually implemented using abstract classes with only static methods (or using singleton patterns). It should be noted that global state may be introduced here, and we need to use dependency injection to avoid it. example Zend […]

  • PHP design patterns fluent interface code examples (17)

    Time:2020-12-3

    objective Used to write easy to read code, just like natural languages (e.g. English) example Yii framework: cdbcommand and cactiverecord also use this pattern The querybuilder of doctrine2 is similar to the following example Phpunit uses a coherent interface to create mock objects UML diagram The official PHP advanced learning exchange community “click” manages and […]

  • PHP design pattern proxy code examples (19)

    Time:2020-12-2

    objective Provides an interface for resources that are expensive or cannot be replicated. This proxy provides access control for other objects. Proxy mode is used to create proxy object, which allows proxy object to control the access of target object (target object can be remote object, create expensive object or object requiring security control), and […]

  • Coding Devops code quality practical combat series lesson 1, this week!

    Time:2020-12-1

    With the rise of Tob (Enterprise Service) and the maturity of TOC (consumer Internet) products, the loss caused by online failures is becoming more and more serious, and the quality of code is becoming more and more important. Quality built-in is one of the core concepts of Devops. The first lesson of coding Devops code […]