Slide 1

Slide 1 text

Duck Typing @ruby_gdl << @solojavier # Based on chapter 5 of book poodr.com

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

Learning by example

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

requirements.change!

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

code_design.add(:duck_typing)

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

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