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

Reviewing Kotlin Code

Avatar for Rachit Rachit
October 27, 2018

Reviewing Kotlin Code

Reviewing Kotlin Code

The talk is about looking into the kotlin language features and their right usage in feature development

Avatar for Rachit

Rachit

October 27, 2018

More Decks by Rachit

Other Decks in Programming

Transcript

  1. Why Code Reviews Provide Positive Feedback Make sure code design

    and quality is consistent and performant Knowledge Sharing
  2. Code Reviews The Good Understand the context Looks for edge

    cases and test coverage Suggests changes along with code samples Provides suggestions with external sources Maintains empathy in conversation Inspires Encourages good code
  3. The Process (After PR)... CI Danger, Ktlint, Errorprone Unit Tests

    Self Review Peer Review Merge to dev New PR
  4. The code review Top down approach High Immutability Low Complexity

    Pure functions Simpler classes SOLID Principles DRY, YAGNI Low Coupling Single Responsibility
  5. Basics & Functions Platform types Using conditionals as expressions Default

    values Pure functions Lesser branches Single level of Abstraction (SLAP functions)
  6. Functions ... Using local functions Using extension functions Using lambda

    functions Inline functions Top level functions Higher order functions (with, apply, let) Function References vs Lambda functions
  7. Classes Prefer DI Delegation with property delegation Delegation with lateinit

    Delegation with interface delegation Data classes Objects
  8. Classes ... Lambda calls in place of SAM Default implementation

    in Interface Hiding abstractions Enum classes Sealed classes
  9. The std library ... Immutable collections Property delegates Standard functions

    (with, apply, let) Extension functions on collections, types Ex. subscriptions.map { it.expiredOn }.any { it != null }