Qt dependency injection
Maximilian Kossick
maximilian.kossick at googlemail.com
Tue Sep 8 09:11:44 CEST 2009
Hi guys,
after reading Jos' blog on singletons
(http://www.kdedevelopers.org/node/4059, although I disagree with his
conclusion), and knowing that this is basically a solved problem in
the Java world thanks to dependency injection containers like Spring,
I've started to wonder why Qt does not provide a DI container itself,
which should be possible using QObjects.
A bit of googling showed: there actually is one:
http://qtioccontainer.sourceforge.net
The only problem is that the last update was three years ago...
This is just a heads up that I'm going to play with it on one of the
next weekends. A major advantage that this could give us is that we
could get replace all those ::instance() methods with code that looks
up the object in the application context, and actually returns a mock
object for tests by defining a special application context for the
tests. Using that approach, we could start to write tests for major
components that are unfortunately untestable at the moment in my
opinion.
Cheers,
Max
More information about the Amarok-devel
mailing list