Dependency Injection: Of Dependency and Casting Calls
What is Dependency Injection?
Instead of letting individual objects find or create their own instances
of the objects with which they collaborate, or making them go through
a Service Locator, we let an external agent find these objects
and then pass them in to the individual instances instead.This way, dependencies are "injected" into these collaborators
instead of being hard-wired into the code.
Injectors pass in information about collaborators using constructors and/or setters.
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |