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 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 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 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):