Git Product home page Git Product logo

androidkodeinsample's Introduction

Android Scoped DI using Kodein

This repo provides an end to end Android app encoded using Clean Architecture, and a DI approach based on scopes to provide testability.

The repo is a sample project for the caster.io Kodein course about the same subject.

Lessons

  • What's Kodein?: What is Kodein and how is it different from other frameworks like Dagger
  • First steps: Fetch Kodein dependency on Build gradle. (Explain difference between artifacts kodein-generic-jvm or kodein-erased-jvm)
  • Application Scope: Start by creating an Application Kodein container to provide application scoped dependencies.
  • Your first injection: Use the application scope to inject your first dependency (A simple Logger)
  • Lazy injections: Explain the concept of laziness in DI frameworks and Kodein
  • Scoped Injection - Activity Scope: Explain the concept of scoped injection by providing a second scope: The Activity one.
  • Activity scoped dependencies: Use the activity scope to inject a Presenter, which will just need to live under that scope.
  • Transitive dependencies: Inject a use case on presenter to showcase how Kodein solves the problem of nested transitive dependencies.
  • Injecting Singletons: Explain why singletons are often needed by providing a singleton instance for a photo data source.
  • Tagged Injections: Explain why two bindings for the same type collide and how to resolve the problem with tagged bindings. Use it to provide two different OkHttp Interceptors.
  • Constant Injection: Showcase how Kodein allows to define bindings for constants and not just entities. Use the concept to provide a TTL for the local photos cache.
  • Adding a Detail Activity: This lesson is a good chance to recap the process we followed for the photos list activity Kodein scope, but over a new detail activity.
  • Injecting Navigation: Inject a Navigator in Presenter and showcase how we can provide a different Context instance per scope, showcasing the benefit of Kodein binding overrides.
  • Injecting Fragments: We're adding a fragment to the detail activity and showcasing how to create a new scope: Fragment Scope.
  • Injecting Custom Views: Let's add a custom view and explain how Kodein allows Custom Views to auto inject, the same way activities or fragments do.
  • Testing your architecture (mock injection): This lesson offers and end to end black box unit testing scenario where thanks to DI we replace the pieces that depend on frameworks by mocks. DI helps us to replace those at any arbitrary depth on the dependency tree.
  • Injecting Mocks on your UI tests: Learn how to write UI tests reusing production Kodein modules for fulfilling dependencies but replacing just the required parts in the graph thanks to Kodein module overrides.

Screenshots

androidkodeinsample's People

Contributors

jorgecastilloprz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.