Design Pattern: Prototype Pattern in Java
Prototype pattern is used to create a new object by cloning an existing one, to reduce the resource usage of object creation. This article demonstrates Prototype pattern implementations in Java.
Prototype pattern is used to create a new object by cloning an existing one, to reduce the resource usage of object creation. This article demonstrates Prototype pattern implementations in Java.
Visitor pattern moves the operation or calculation part from the element/subject classes to a completely separate class. That separate class is called the visitor. As the operation/calculation is moved to the visitor class, so if we want to change the operation then we can just change the visitor class. No change in the subject classes is required in that case.
Visitor pattern is used to move the operation/calculation part from a group of classes to a completely separate(Visitor) class. This article demonstrates Visitor pattern implementations in Java.
Template method pattern when we want the subclasses to define some steps of the processing steps (or algorithm). The parent class can define some steps and subclasses can some(which are required). Functionalities/steps which are completely different for subclasses are left to the subclasses for definition. The parent (abstract) class works are a skeleton here.
Template Method pattern is used to implement a process where subclasses can change some steps of the parent. This article demonstrates Template Method pattern implementations in Java.
Here we are discussing the implementation of Server-Server Events(SSE) using Python, specifically using the Flask framework. We are discussing 2 ways to implement SSE in Flask-Using Flask Features (without any extra package) and using Flask-SSE package.
In State pattern, an object (context object) changes its behavior when a certain internal state is changed. On state change the context object will change its behavior completely- like for performing a certain operation the context object will use different objects when the state is changed. This state change is managed internally so the client which is using the context object might not be aware of the state change.
State pattern is used to change the behavior of an object when the state is changed. With the change in state, the behavior of that object is completely changed. This article demonstrates State pattern implementations in Java.
Observer pattern deals with state change between related objects. When one object depends on any state of another object, then when the state changes the dependent object needs to be notified. Observer pattern enables the dependent objects to subscribe to the state change of the subject object.
Observer pattern is used to automatically notify state change in object to all its dependent objects. It works as a pub/sub for state change between objects. This article demonstrates Observer pattern implementations in Java.