Duck Typing


@ruby_gdl << @solojavier


# Based on chapter 5 of poodr.com book

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 




Learning by example





requirements.change!






code_design.add(:duck_typing)







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

Duck Typing

By solojavier

Duck Typing

  • 1,629