1/16
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
wiring
for a system to work, each component’s required interfaces have to be provided by another’s interface
wiring stage 1
deciding which component will provide which required interfaces
wiring stage 2
performing the binding to connect the chosen components together
benefits of dependency injection 1
late binding - services can be swapped with others
benefits of dependency injection 2
extensibility - code can be extended and reused in ways not explicitly planned for
benefits of dependency injection 3
code can be developed in parallel
benefits of dependency injection 4
classes with clearly defined responsibility are easier to maintain
cup and ball diagrams
full circle provides, half circle requires
wiring question 1
when does it occur? at installation? at start up? dynamically through lifetime?
wiring question 2
how is the wiring specified? implicitly? explicitly as code? or explicitly as workflow?
wiring at installation pros
detect anomalies, find missing components
wiring at installation cons
not very extensible and not very robust
wiring at startup pros
find issues before any user touches the system, clear behaviour, extensible when system restarts
wiring at startup con
subject to binding failures
wiring dynamically notes
more flexible and extensible, but more complex
interface compatibility option 1
name based - interfaces have the same name
interface compatibility option 2
structural type - interfaces respond to the same operations or messages