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

Duck Typing

Duck Typing

Based on chapter #5 of POODR.

Given at rubygdl.org.

Javier Cervantes

May 30, 2014
Tweet

More Decks by Javier Cervantes

Other Decks in Programming

Transcript

  1. What is Duck Typing "If an object quacks like a

    duck and walks like a duck, then it's a duck" Technique that help us reduce cost of change Public interfaces not tied to any specific class Duck typed objects are chameleons that are defined more by their behaviour than by their class
  2. Summary Duck typing detaches public interfaces from classes It creates

    virtual types defined by behaviour Depending on this abstractions increases flexibility This will make your application easier to change