Qt dependency injection

Alejandro Wainzinger aikawarazuni at gmail.com
Tue Sep 8 09:35:54 CEST 2009


+1, did you ask the Trolls about why Qt doesn't provide a DI container?

On Tue, Sep 8, 2009 at 9:11 AM, Maximilian
Kossick<maximilian.kossick at googlemail.com> wrote:
> 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
> _______________________________________________
> Amarok-devel mailing list
> Amarok-devel at kde.org
> https://mail.kde.org/mailman/listinfo/amarok-devel
>


More information about the Amarok-devel mailing list