From c89766399d1b3929549c08afb0bd2727bbb08f07 Mon Sep 17 00:00:00 2001 From: Umair Ashraf Date: Thu, 5 Aug 2021 20:56:42 -0400 Subject: [PATCH 1/4] Update abstractfactory.py --- abstractfactory.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/abstractfactory.py b/abstractfactory.py index 43bf19a..8cec25e 100644 --- a/abstractfactory.py +++ b/abstractfactory.py @@ -1,4 +1,7 @@ -"""Implementation of the abstract factory pattern""" +""" +Provide an interface for creating families of related or dependent objects without specifying their concrete classes. + +Implementation of the abstract factory pattern""" import random From a1e0c5a78c5d44f472a76c9be2525a001918b1e5 Mon Sep 17 00:00:00 2001 From: Umair Ashraf Date: Thu, 5 Aug 2021 21:02:11 -0400 Subject: [PATCH 2/4] Update factory.py --- factory.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/factory.py b/factory.py index 717497e..cf005ee 100644 --- a/factory.py +++ b/factory.py @@ -1,3 +1,8 @@ +""" +Define an interface for creating a single object, but let subclasses decide which class to instantiate. + Factory Method lets a class defer instantiation to subclasses. +""" + class Pizza(object): def __init__(self): self._price = None From 7c173beb0e85daedda216c51a3b7e56425ed8fb2 Mon Sep 17 00:00:00 2001 From: Umair Ashraf Date: Thu, 5 Aug 2021 21:05:30 -0400 Subject: [PATCH 3/4] Update proxy.py --- proxy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxy.py b/proxy.py index de64dd5..ce95469 100644 --- a/proxy.py +++ b/proxy.py @@ -1,5 +1,10 @@ # -*- coding: utf-8 -*- +""" +Tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. + This pattern appears in the GoF catalog as "virtual proxy", an implementation strategy for the Proxy pattern. +""" + class IMath: """Interface for proxy and real subject.""" def add(self, x, y): From 2e7e3c5fabda1d75b1c4ccb7e3aab64e86227b13 Mon Sep 17 00:00:00 2001 From: Umair Ashraf Date: Thu, 5 Aug 2021 21:11:08 -0400 Subject: [PATCH 4/4] Update prototype.py --- prototype.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/prototype.py b/prototype.py index 8b27676..99ee77d 100644 --- a/prototype.py +++ b/prototype.py @@ -1,3 +1,8 @@ +""" +Specify the kinds of objects to create using a prototypical instance, and create new objects from the 'skeleton' of an existing object, + thus boosting performance and keeping memory footprints to a minimum. +""" + from copy import deepcopy, copy copyfunc = deepcopy