added external design pattern documentation links to creational patterns.
This commit is contained in:
@@ -6,6 +6,8 @@ class Director(object, metaclass=ABCMeta):
|
||||
Abstract director class, responsible for using a builder to fully construct an object.
|
||||
|
||||
Part of the builder pattern.
|
||||
|
||||
External Builder Pattern documentation: U{https://en.wikipedia.org/wiki/Builder_pattern}
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
@@ -39,6 +41,8 @@ class Builder(object):
|
||||
Abstract builder class, responsible for constructing various pieces of an object.
|
||||
|
||||
Part of the builder pattern.
|
||||
|
||||
External Builder Pattern documentation: U{https://en.wikipedia.org/wiki/Builder_pattern}
|
||||
"""
|
||||
|
||||
def __init__(self, constructed_object):
|
||||
|
||||
@@ -6,8 +6,9 @@ class Factory(object, metaclass=ABCMeta):
|
||||
Factory Interface.
|
||||
|
||||
All Factories should inherit this class and overwrite the create method.
|
||||
"""
|
||||
|
||||
External Factory Pattern documentation: U{https://en.wikipedia.org/wiki/Factory_method_pattern}
|
||||
"""
|
||||
@abstractmethod
|
||||
def create(self, **kwargs):
|
||||
"""
|
||||
@@ -23,8 +24,9 @@ class Factory(object, metaclass=ABCMeta):
|
||||
class AbstractFactory(Factory):
|
||||
"""
|
||||
Abstract Factory Class.
|
||||
"""
|
||||
|
||||
External Abstract Factory Pattern documentation: U{https://en.wikipedia.org/wiki/Abstract_factory_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize the abstract factory.
|
||||
|
||||
@@ -5,8 +5,9 @@ from .singleton import Singleton
|
||||
class Reusable(object):
|
||||
"""
|
||||
An abstract reusable class.
|
||||
"""
|
||||
|
||||
External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
Initialize a new Reusable instance.
|
||||
@@ -24,8 +25,9 @@ class Reusable(object):
|
||||
class Pool(object, metaclass=Singleton):
|
||||
"""
|
||||
An Object Pool design pattern implementation.
|
||||
"""
|
||||
|
||||
External Object Pool Pattern documentation: U{https://en.wikipedia.org/wiki/Object_pool_pattern}
|
||||
"""
|
||||
def __init__(self, reusable_class, *args, **kwargs):
|
||||
"""
|
||||
Initialize a new object pool instance.
|
||||
|
||||
@@ -5,8 +5,9 @@ from types import MethodType
|
||||
class Prototype(object):
|
||||
"""
|
||||
Prototype design pattern abstract class.
|
||||
"""
|
||||
|
||||
External Prototype Pattern documentation: U{https://en.wikipedia.org/wiki/Prototype_pattern}
|
||||
"""
|
||||
def prototype(self, **attributes):
|
||||
"""
|
||||
Copy the prototype this object and optionally update attributes.
|
||||
@@ -22,4 +23,3 @@ class Prototype(object):
|
||||
setattr(obj, attribute, attributes[attribute])
|
||||
|
||||
return obj
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ class Singleton(type):
|
||||
Singleton Metaclass.
|
||||
|
||||
Enforces any object using this metaclass to only create a single instance.
|
||||
|
||||
External Singleton Pattern documentation: U{https://en.wikipedia.org/wiki/Singleton_pattern}
|
||||
"""
|
||||
__instance = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user