Factory Pattern

class CompressionFactory: compression = {} def __new__(cls): cls.compression = {"rar": Rar(), "tar": Tar(), "zip": Zip()} return cls @classmethod def getCompression(cls, method): return cls.compression[method]import abcclass File(abc.ABC): def __init__(self, txt): self.txt =…

Continue ReadingFactory Pattern

Proxy Pattern

In proxy pattern, a class represents functionality of another class. This type of design pattern comes under structural pattern. In proxy pattern, we create object having original object to interface…

Continue ReadingProxy Pattern