I had mentioned about Inversion of Control (IoC) in my earlier post Inversion of Control – for easy integration. In this post I will show you how you can actually make your integration easy with implementation of a mini application sample based on IoC.
Objective
The main objective of this mini tutorial is to highlight the implementation of an interface based Inversion of Control (IoC) architecture and to state how it could help in the integration and maintenance of the application.
For this mini application I will use the following set of classes
- Dependency – This is the interface which is implementation as per my application versions progress and which will be used by the View components in my application. In other words this is my Model component in a MVC architecture
- Dependent – This is my View component which uses the Model component to produce the results for displaying. As the name suggests the class is dependent on the Dependency implementation.
- Injector – This is most important class in the application and which introduces the aspect of Inversion Of Control into the applications. This class can also be referred as the configurator class.
- Finally there can a number of implementations of the Dependency interface according to the needs of the application.
Note: This mini tutorial is based on the concept of Interface based IOC. It also assumes that you import the required classed in your Classes when compiling them.
Lets start with our tutorial. Read the rest of this entry »