Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Solid principles for Android developer

Solid principles for Android developer

Popular SOLID practices on Android

Avatar for Anh Vu

Anh Vu

May 28, 2017

Other Decks in Technology

Transcript

  1. SOLID PRINCIPLES 1. SINGLE REPONSIBILITY 2. OPEN / CLOSED 3.

    LISKOV SUBSTITUTION 4. INTERFACE SEGREGATION 5. DEPENDENCY INVERSION
  2. SINGLE REPOSIBILITY • “A class should have only one reason

    to change.” • Example: RecyclerView’s Adapter: – Only adapter’s responsibility: mapping an object to its corresponding view. FAIL!!!
  3. OPEN/CLOSED • “software entities (classes, modules, functions, etc) should be

    open for extension, but closed for modification” FAIL!!!
  4. LISKOV SUBSTITUTION • “Objects in a program should be replaceable

    with instances of their subtypes without altering the correctness of that program.”
  5. DEPENDENCY INVERSION 1. “High-level modules should not depend on low-level

    modules. Both should depend on abstractions.” 2. “Abstractions should not depend on details. Details should depend on abstractions.” Traditional application layers