Hi,
Well IoC is Inversion of Control and has lot to do with creating objects.
(Design Pattern info http://martinfowler…injection.html)
Best introduction is here… http://www.theserver…IntrotoSpring25
Benefits of IoC in a Java application (http://appfuse.org).
Able to utilize various frameworks, OR Mapper, Logging systems, … with little effort.
In a very simple illustration,
Application needs to several Components
IBizRule $biz = Create ComplexBizRule
IDatabase $db = Create CMySqlDatabase
ILogger $logger = Create CFileLogger
With Inversion of Control
Use the "Factory" the create the Application object,
The Factory is configured with the Dependencies for the Application
like $complexBusinessRule, $db and $logger
The Factory in the process of creating the Application will also create the
the configured ComplexBizRule, CMySqlDatabase and CFileLogger objects and
Application->setBizRule(), Application->setDatabase(), Application->setLogger()
Since the application uses the IBizRule, IDatabase and ILogger interfaces,
the configuration can be changed to use stubs for testing.
This is very useful when you want to stub ComplexBizRule.
Hope this makes it little more clear.
It does seem like your are using a "Factory" type object creation in CConfiguration, it maybe better to to use a Factory pattern.
Maybe you can get a more concrete info from a small Java implementation http://www.picocontainer.org/ guys. I can’t seem to find a PHP IoC implementation. I’m willing to work on it if you are interested in it.
Thanks,
Edward