Visitor Pattern

When you have File class with all print(), email() with inherited classes to WordFile, PictireFile, PreadSheet, .... Your new requirement are adding compress method on each classes. This is simple…

Continue ReadingVisitor Pattern

Decorator Pattern

import abcclass Shape(abc.ABC): @abc.abstractmethod def draw(self): passclass Triangle(Shape): def draw(self): print("Triangle")class Circle(Shape): def draw(self): print("Circle")# Decorator was not needed to be inherited from Shape in Python.But you can enforce the…

Continue ReadingDecorator Pattern