MOAL.software_engineering.problem_solving.design_patterns.solid package

Submodules

MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion module

class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.Application(*args, **kwargs)[source]

This class no longer requires any knowledge of the logger type, because it’s passed in. So long as the methods match, it will just work. This is called dependency injection.

__init__(*args, **kwargs)[source]
log(message)[source]
logger = None
class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.EMailMessenger[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.Messenger

message_action(message)
class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.LoggingMessenger[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.Messenger

message_action(message)
class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.Messenger[source]

This class acts as a layer of indirection and inverts the dependency of the higher-level modules that use it, by provide a more abstract messaging mechanism. This makes any messenger that subclasses this class “pluggable”.

message_action(message)[source]
class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.SMSMessenger[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.Messenger

message_action(message)
class MOAL.software_engineering.problem_solving.design_patterns.solid.dependency_inversion.StillCoupledApplication(*args, **kwargs)[source]

This is the highest level class, and requires some kind of logging mechanism. It’s easy to plug new loggers into this class because they all reside in front of a common class. The problem is, they still require knowledge of which logger to use.

__init__(*args, **kwargs)[source]
log(message)[source]
logger = None

MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation module

class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMAuthentication[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMLogging

_validate(info)

Nonsense validation function

authorize_pin(info)
class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMDeposit[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMLogging

handle_deposit(info, amt)
class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMLogging[source]
add_transaction_log(info)
calculate_balance(info)
class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMUserEvents[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMLogging

clear_info()
eject_card()
print_receipt(info)
process_button(button_event)
class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMWidthdrawl[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.ATMLogging

handle_withdrawal(info, amt)
class MOAL.software_engineering.problem_solving.design_patterns.solid.interface_segregation.MonsterATMClass[source]

A bad example of a large class handling everything.

_validate(info)[source]

Nonsense validation function

add_fee(info, amt)[source]
add_transaction_log(info)[source]
authorize_pin(info)[source]
calculate_balance(info)[source]
clear_info()[source]
handle_deposit(info, amt)[source]
handle_withdrawal(info, amt)[source]
print_receipt(info)[source]

MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution module

class MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution.ColoredSquare[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution.Square

__abstractmethods__ = frozenset([])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>
class MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution.Rectangle[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution.Square

__abstractmethods__ = frozenset([])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>
set_height(h)
set_width(w)
class MOAL.software_engineering.problem_solving.design_patterns.solid.liskov_substitution.Square[source]

Bases: MOAL.type_theory.nominal_structural.StructuralType

__abstractmethods__ = frozenset([])
__init__()
__setitem__(prop, value)
__str__()
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>
set_size(h, w)

MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed module

class MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed.ConnectionManager[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed.ConnectionManagerABC

Valid, since it extends the methods.

__abstractmethods__ = frozenset([])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>
add(ip)[source]
drop(ip)[source]
class MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed.ConnectionManagerABC[source]

Bases: object

The essence of the Open/Closed principle is that objects should be open for extension but closed for modification. This is effectively what an abstract base class (or virtual interface) provides, because it requires anything that uses it to extend from it, rather than changing it directly. In Python the ABC module will enforce this principle by checking that all subclassed methods provide an overriding method if the deriving class has an abstractmethod set.

__abstractmethods__ = frozenset(['add', 'drop'])
__metaclass__

alias of ABCMeta

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>
add()[source]
drop()[source]
ips = {}
class MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed.DistributedConnectionManager[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.open_closed.ConnectionManagerABC

Invalid, since it doesn’t extend the methods.

__abstractmethods__ = frozenset(['add', 'drop'])
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 26
_abc_registry = <_weakrefset.WeakSet object>

MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility module

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Blade[source]
cut()
class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Corkscrew[source]
open_wine()
class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.FlatHead[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.ScrewDriver

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Hex[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.ScrewDriver

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.LargeBlade[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Blade

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Phillips[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.ScrewDriver

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Saw[source]
class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Scissor[source]
class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.ScrewDriver[source]
screw(degrees=90)
unscrew(degrees=90)
class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.SerratedKnife[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Blade

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.SmallBlade[source]

Bases: MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.Blade

class MOAL.software_engineering.problem_solving.design_patterns.solid.single_responsibility.SwissArmyKnife[source]

...What exactly is this for, again?

cut(blade='medium')[source]
file()[source]
magnify()[source]
open_wine()[source]
saw()[source]
scissor()[source]
screw(type='phillips')[source]
tweeze()[source]
unscrew(type='phillips')[source]