Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion abstractfactory.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
5 changes: 5 additions & 0 deletions factory.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions prototype.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 5 additions & 0 deletions proxy.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down