stephanenicolas / toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Apache License 2.0
1.12k stars 115 forks source link

Difference with dagger2 #189

Closed IlyaEremin closed 7 years ago

IlyaEremin commented 7 years ago

It's obvious that dagger2 the main player between DI frameworks for android. What drawbacks of dagger2 toothpick fixing? What the difference? In which cases toothpick more convenient to use? I do not to say what other DI better, just want to know is it worth to switch to toothpick from dagger?

stephanenicolas commented 7 years ago

@IlyaEremin, we can only encourage devs to go beyond the obvious and the trendy hype and look at what the alternatives to Dagger have to offer.

Dagger is for sure a master piece in DI, it's high value resides in the achievement of compile time DI as opposed to runtime. This idea was envisaged since the very beginning of DI. But it might not be enough to say that Dagger is simply the best lib for DI for a few reasons that we mention in the wiki .

We have just added a section to the README referencing alternative DI libs for Android, so that devs can have a good overview of the variety of OSS solutions to DI.

Off course, as the authors of the lib, we are strongly convinced that TP is just better because it is at least as fast as D2, and far more simple, with better testing support, clearer concepts and less work for devs. But we are obviously biased and we invite people to make their own judgements.

The only thing that TP doesn't provide, compared to D2, is: compile time scope verification, and we are actually glad not to have this feature. TP performs runtime scope verification and this provides a more dynamic runtime behavior which is at the heart of TP design, makes it very powerful and more suitable for testing.

I close the issue, but anyone is invited to comment.

We just strongly ask that this page doesn't become a place for an endless and useless intestine war of religion.

IlyaEremin commented 7 years ago

@stephanenicolas thank you for such a great clarification! I missed faq :(