Design Pattern: Decorator Pattern in Python

Decorator pattern is used to add some additional responsibilities to an object dynamically. We can add some new tasks, checking, etc. before and/or after the original functionality of the the object. Using the Decorator pattern we can extend the behavior, with property transparency, and without affecting other objects. In this article, we discuss the implementation of the Decorator Pattern in Python.

Python: Decorator

A decorator is a function that accepts a function and returns a function. We can perform the additional steps of operation(that we want to add before/after the original function), in the implementation of the decorator.

Design Pattern: Prototype Pattern in Python

Prototype pattern enables us to create an object from an existing object(by copying or cloning it), rather than creating an object from scratch. This process saves the overhead of the initialization process required for creating a new object from scratch. In this article, we discuss the implementation of the Prototype Pattern in Python.

Design Pattern: Builder Pattern in Python

Builder design pattern helps us by providing a system to construct complex objects, step by step. Especially when an object has multiple varying parts, and we need an easy way to set up those parts. Where other patterns like the Factory pattern, construct an object in a single step, the Builder pattern enables multi-step build. Builder pattern encapsulates the complexity of the complex multi-step build. In this article, we discuss the implementation of the Builder Pattern in Python.

Design Pattern: Abstract Factory Pattern in Python

Abstract factory pattern works as a logical group for the Factory pattern. Abstract factory is used to generate multiple types of factories, and those factories are used to generate the desired item objects. In this article, we discuss the implementation of the Abstract Factory Pattern in Python.