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

Sticky hands

Vlad
August 14, 2019

Sticky hands

Vlad

August 14, 2019
Tweet

More Decks by Vlad

Other Decks in Technology

Transcript

  1. Software is hard • Thinking in abstractions • Lots of

    patterns to follow • Past personal experience is almost always a sole source of wisdom
  2. Software is hard • Thinking in abstractions • Lots of

    patterns to follow • Past personal experience is almost always a sole source of wisdom • Naming is hard
  3. Value objects • Immutable snapshot of data • Serializable •

    Logic within available properties • Not tested
  4. Value objects • Immutable snapshot of data • Serializable •

    Logic within available properties • Not tested • A thing
  5. Value objects data class User(val firstName: String, val lastName: String)

    { val fullName = "$firstName $lastName" } For Java: - https://github.com/google/auto/tree/master/value - https://projectlombok.org/
  6. Service objects • Fun and business things • Focused on

    one functionality • Composable • Have fake implementations
  7. Service objects • Fun and business things • Focused on

    one functionality • Composable • Have fake implementations • Easy to test and tested thoroughly
  8. Service objects • Fun and business things • Focused on

    one functionality • Composable • Have fake implementations • Easy to test and tested thoroughly • A doer
  9. Service objects class NuclearReactor( private val fissionCreator: FissionCreator, private val

    heatGenerator: Heater, private val cooler: Cooler ) { fun createReaction(): NuclearReactionStatus { return try { val chainReaction = fissionCreator.startChainReaction() val warmReaction = heatGenerator.addSomeHeat(chainReaction) if (warmReaction.producedEnergy > 0) { NuclearReactionStatus.ENERGY } else { NuclearReactionStatus.NOTHING } } catch (boom: Exception) { NuclearReactionStatus.BOOM } } }
  10. Glue • Platform entry points (think main method or spring

    controllers) • Platform service object types
  11. Glue • Platform entry points (think main method or spring

    controllers) • Platform service object types • Integration tested or not tested
  12. Glue • Platform entry points (think main method or spring

    controllers) • Platform service object types • Integration tested or not tested • SomethingSomethingPlatformSpeak
  13. Sticky hands • Run away from the glue as soon

    as possible, leave minimal code behind
  14. Sticky hands • Run away from the glue as soon

    as possible, leave minimal code behind • Pull service objects out of the glue, don’t forget to wipe them
  15. Sticky hands • Run away from the glue as soon

    as possible, leave minimal code behind • Pull service objects out of the glue, don’t forget to wipe them • Wear Interfaces to not touch the glue directly
  16. Fin