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

Duck Typing from POODR

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Duck Typing from POODR

Avatar for Steve Robinson

Steve Robinson

February 04, 2016
Tweet

More Decks by Steve Robinson

Other Decks in Programming

Transcript

  1. Consequences • We've moved from depending upon a concrete interface

    (Mechanic) to an abstract interface (the Preparer duck type) • Concrete – Easy understanding but hard to extend • Abstract – Tougher to comprehend but easy to extend (change) • Polymorphism!! --> Now is this what they taught us in college?
  2. Where to use duck types? • When you see following

    constructs - – Switching on class – kind_of? And is_a? – responds_to? • “I know who you are and because of that I know what you do” - shows distrust on objects. • Look at the offending code's expectations and identify ducks.
  3. Some podcasts • Code Newbie • RubyRogues • JS Jabber

    • Full Stack Radio • BikeShed • Giant robots smashing into other giant robots