16. INVERSION OF CONTROL
INTENT:
Inversion of control is a style
of software construction where
reusable code controls the execution
of problem-specific code
18. “ Inversion of control is a common
characteristic of frameworks,
so saying that these lightweight containers
are special because they use inversion of
control is like saying my car is special
because it has wheels.”
19. “ DON’T CALL US
WE’LL CALL YOU ”
INVERSION OF CONTROL
HOLLYWOOD PRINCIPLE:
21. "Dependency Injection is where
components are given their
dependencies through their
constructors, methods, or directly
into fields."
PICO CONTAINER DEFINITION:
22. Dependency injection allows the
removal of hard-coded dependencies
and makes it possible to change
them, whether at run-time or compile-
time.
26. ??
DEPENDENCY INJECTION AND FRAMEWORKS
Grafico con spaghetti, infermiera che fa la
puntura, lista della spesa per l'antipattern
service locator, qualcosa di galattico per
l'enhanced injection (tipo pulp fiction)
DI
DIC
http://www.loosecouplings.com/2011/01/dependency-injection-using-di-container.html
27. INTENT:
Define an interface for creating an object,
but let subclasses decide which class
to instantiate.
Factory Method lets a class defer instantiation to
subclasses.
FACTORY METHOD
31. INTENT:
Separate the construction of a
complex object from its
representation so that the same
construction process can create
different representations.
BUILDER
36. INTENT:
Define an object that encapsulates how a set
of objects interact. Mediator promotes loose
coupling by keeping objects from referring to
each other explicitly, and it lets you vary their
interaction independently.
MEDIATOR
38. INTENT:
Defines a family of algorithms, encapsulate
each one, and make them interchangeable.
Strategy lets the algorithm vary independently
from clients that use it.
STRATEGY aka POLICY
41. INTENT:
A layer of Mappers that moves data between
objects and a database while keeping them
independent of each other and the mapper
itself.
DATA MAPPER
42. INTENT:
Represent an operation to be performed on
the elements of an object structure.
Visitor lets you define a new operation without
changing the classes of the elements on which
it operates.
VISITOR