
https://code.google.com/p/infectorpp/
If you had any of the following problems when developing games you might want to take a look to the project (beware: requires c++11)
- Bored to pass a Context around
- Always have to relies on Device, Driver or super classes to retrieve what you need
- Usage of service locators (basically same of Device, a class you use to access other classes)
- Usage of singletons (Service locator in its worst shape)
- Difficult to change existing code even if you planned it well using design patterns
- Monolitic classes
- Memory leaks that are NOT located in stuff like data containers (anything that could be reference counted in example).
- You use exceptions and you always have to double check constructors to avoid memory leaks
The basic idea is to focus classes only on their role. Creation of devices and dependencies is "left to someone else (the IoC container)". The only classes that instantiate something are factories. I needed few months to grasp the concept so I don't pretend it will be easy for you. Basically if you need something, you ask for it in constructor, and someone will magically provide that dependency to you. You don't have to warry "were" to instantiate needed dependencies. This make the project more flexible and easy to change.
Using the "library" (6 methods and 1 class) does immediatly brings advantages, but you also need to understand how it works to have its full potential at use.
If anyone used Spring framework, this library is a subset of Spring functionalities (more polished, and adapted to C++ with the very essential features. user friendly and less error-prone, of course C++ lack certain features like reflection and so DI can't be done in the same way other frameworks do it in other languages.)