DPML
DPML Metro Inversion of Control Principals
HomeUtilitiesStationMetro
Inversion of Control

Inversion of Control (IOC) is name given to the general principal of removing responsibility from a component implementation concerning the sourcing and resolving of dependencies and resources. In effect the result of removing these concerns results in cleaner, simpler, and smaller components.

Resource Identification

The first area of control "inversion" relates to the use of resource identifiers (URIs) in preference to resource locators (URLs). A URI identifies the resource but does not expose information concerning location. Through a collection of URI scheme handlers the Metro platform provides the environment within which a component implementation can operate exclusively with URI references. This moves potential resource handling limitations from a component by delegating the concern to an underlying resource management framework.

Dependency Injection

A number of different techniques have emerged in recent years dealing with the generic assembly overhead. These include concepts such as "Service Locators" (typified by the Avalon Framework), "Constructor Injection" (PICO style), and Setter Injection (typified by Spring). Metro addresses the dependency injection concern through the implementation of "Context Awareness" within the container. In effect - the component declares service dependencies through an inner Context interface and the container is responsible for the delivery of a full-populated type-safe context implementation.

Component Composition

Composition relates to the general area of building component implementations using existing components. Unlike the general assembly concern (wiring of service providers to consumers), composition deals with the construction of internal parts of a component resulting in the creation of new self-contained composite component. The Metro container formally recognizes and supports the notion of internal parts of a component and the corresponding role of a component as a composite.