Review of my Dependency Injection talk at Android Dev Saigon meet up

I gave a talk about Dependency Injection on last weekend and It was my first public speaking ever. I want to say thanks to anyone who attended this talk, you guys was my big support, thank you so much. But for lacking of experience my talk was not smooth and did not give you— my listeners enough information about dependency injection as well as Dagger 2 library. So I decided to write this blog to correct my fault.

First of all, I forgot to talk about why Dagger is named as Dagger. Actually it is coming from DAG which stands for directed acyclic graph. So we know Dagger is a directed graph without any cycle. So we cannot create a cycle dependency when using Dagger, it will throw exception in compile time. For example we can not create something like: A dependents to B, B dependents to C, and C dependents to A. It is a cycle dependency, we should avoid it when using Dagger.

Because of time constraint, I could not walk throw how to add Dagger to your project. So I just created a small gist about dagger 2 configuration with comments. You can see it here: Dagger 2 Configuration.

The last thing I want to mention is I have learned a lot of things after the talk. I have better understanding about dependency injection as well as Dagger when I preparing for the talk. So that sharing and talking is one of the best way to learn and hope it is the same for everyone. Thank you again for attending and listening.

Materials of the talk:


Dagger 2 Example

  • Toan Tran

    Thanks for your sharing on this topic. Walk through your Slide-deck presentation, found something
    “`Google Guice: …. use reflection in Runtime to generate code….“` Well, since Guice already armed with `Reflection all` so it does not need to generate code to wire up components together, rather it performed this wiring-up runtime (not compile time – to generate code). Correct me if I’m wrong 😉

    • lenguyenthanh

      Thanks @disqus_K9Wen0SINy:disqus, your comment totally corrects. Guice uses reflection in runtime for wiring-up not generating code. It was my mistake. Thank you again for your great response 😉