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

Perth Code Dojo 3

Perth Code Dojo 3

Inheritance vs composition

William Webster

October 02, 2014
Tweet

More Decks by William Webster

Other Decks in Programming

Transcript

  1. Check-In ➔ Your name ➔ What you do (at work)

    ➔ A random fact about yourself
  2. Code Dojo Format A Coding Dojo is a coding session

    centered around a programming challenge. The dojo provides a safe place to learn and experiment away from the pressures of business delivery. All programmers of varying skill levels meet as equals to learn and share.
  3. XP Practices ➔ Paired Programming ◆ A better design ◆

    Collective code ownership ◆ Improved quality / less defects ◆ High standards ◆ Focus / A pair is harder to distract
  4. Pomodoro ➔ Pomodoro Technique ◆ 25 mins on, 5 mins

    off ◆ http://tomatoi.st/perthcodedojo ➔ Four iterations
  5. Retro & Pizza Closing with Pizza and a mini retrospective

    ➔ Share solutions on the big screen ➔ Discuss challenge / approach ➔ Feedback on the dojo
  6. Objective Inheritance for: ◦ versioning / commonality ◦ keeping state

    ◦ not forcing implementation - can stick with base
  7. Objective Composition for: ◦ Applied to many disparate objects ◦

    Has-a concept ◦ Polymorphism Liskov substitution principle ◦ Breaking changes
  8. Create a basic garden Dimensions (50 metres x 10 metres)

    Soil type = clay Last watered Positional (X / Y) 1 x trees 2 x flowers
  9. Second garden type Japanese Garden Dimensions (80 metres x 20

    metres) Soil type = silt Positional (X / Y) 1 x ornate bridge 2 x trees
  10. Third garden type Modern Low Maintenance Dimensions (20 metres x

    12 metres) Soil type = na Area covered 1 x Artificial Lawn
  11. Mini Retro How would you refactor to improve the design?

    Discuss when to apply inheritance for re-use? Any real examples where you have felt inheritance pain?