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

Inheritance or Composition

Inheritance or Composition

These slides are the material that I use as support on my talk about Inheritance and Composition on Android.

Avatar for Txus Ballesteros

Txus Ballesteros

July 18, 2016
Tweet

More Decks by Txus Ballesteros

Other Decks in Programming

Transcript

  1. ≥ Inheritance Bad Smells • Having infinite levels of inheritance.

    • Extents of a non abstract classes. • Base classes with more than 100 200 lines.
  2. ≥ Activity.java Android Donut: 3.629 lines of code https://github.com/android/platform_frameworks_base/blob/donut-release/core/java/android/app/Activity.java Android

    KitKat: 5.468 lines of code https://github.com/android/platform_frameworks_base/blob/kitkat-release/core/java/android/app/Activity.java Android Marshmallow: 6.649 lines of code https://github.com/android/platform_frameworks_base/blob/marshmallow-release/core/java/android/app/Activity.java
  3. ≥ Fragment.java Android ICS MR1: 1.564 lines of code https://github.com/android/platform_frameworks_base/blob/ics-mr1-release/core/java/android/app/Fragment.java

    Android KitKat: 1.920 lines of code https://github.com/android/platform_frameworks_base/blob/kitkat-release/core/java/android/app/Fragment.java Android Marshmallow: 2.559 lines of code https://github.com/android/platform_frameworks_base/blob/marshmallow-release/core/java/android/app/Fragment.java
  4. ≥ TextView.java Android Donut: 7.317 lines of code https://github.com/android/platform_frameworks_base/blob/donut-release/core/java/android/widget/TextView.java Android

    KitKat: 9.231 lines of code https://github.com/android/platform_frameworks_base/blob/kitkat-release/core/java/android/widget/TextView.java Android Marshmallow: 10.194 lines of code https://github.com/android/platform_frameworks_base/blob/marshmallow-release/core/java/android/widget/TextView.java
  5. ≥ S O L I D RP Single Responsibility CP

    Open Close SP Liskov Substitution SP Interfaces Segregation IP Dependency Inversion