Interpreter pattern represents the grammar or syntax rules of an expression. Parsing the expression and evaluation is implemented in the pattern implementation. The implementation can be for a specific syntax of a specific type of expression. A specific set of rules is defined for parsing and evaluation/operation. In this article, we are discussing the implementation of the Interpreter pattern in PHP.
Iterator pattern is used to access items sequentially from an aggregated object. The client does not need to know the underlying details of the iterator, it can just use the iterator easily. This pattern makes it very easy for the client to traverse through a list of objects, one by one. It can also implement the traversing process in any order (ascending or descending) if required. This article demonstrates the Iterator pattern implementation in PHP.
Command pattern encapsulates a full request in an object. So, the object can be passed as a parameter or can be queued or saved in log. Later the object can be revived and we get the full request, which can be executed and/or undoned at any point in time. This article demonstrates Command pattern implementations in PHP.
Chain of Responsibility pattern gives responsibility of a process handling to more than one object(a chain of objects) so that the sender and receiver of the request remains decoupled. The chain of objects pushes the processing to the next step until the processing is complete. This article demonstrates Chain of Responsibility pattern implementations in PHP.
State pattern implements completely different behavior of an object based on some state. This pattern is normally used for heavy processing multiple-step operations. This article demonstrates State pattern implementations in Golang.
Proxy pattern is used provide a placeholder or surrogate for an original object. Operation performed the proxy, calls operation(s) from the original object. This proxy object existing between the client and the original object to provide security and/or access control and/or additional functionality. This article demonstrates Proxy pattern implementations in PHP.
Flyweight pattern shares basic object resources to generate a large number of objects efficiently. Flyweight pattern is used to reduce memory footprint. This article demonstrates Flyweight pattern implementations in PHP.
Facade introduces a new interface for the client to interface with the underlying complex subsystem classes. This is a high-level interface that hides the subsystems from the clients. Facade uses the objects and method from the already existing class(subsystem) objects. It is the responsibility of the facade, to provide the desired functionality to the client, with simplicity. This article is about the Facade pattern implementation in PHP.
Decorator pattern dynamically attaches additional responsibility to an object. This pattern is used to extend functionality without affecting the existing implementation. If we just use inheritance, then we can extend the functionality of a class. But by using a decorator we can enhance/extend and/or change the functionality of an object at run time. This article demonstrates Decorator pattern implementation in PHP.
Composite pattern represents the hierarchy of a group of objects in a tree structure. The client can treat a single object and list/group of objects the same way, so it becomes easy for the client. This article describes Composite pattern implementation in PHP.