Stuff about software development, agile and testing

Showing posts with label duck typing. Show all posts
Showing posts with label duck typing. Show all posts

Tuesday, July 10, 2007

Duck Typing

I was reading a blog by Bill Venners about duck typing and kind of liked the following extract

...Don't check whether it IS-a duck: check whether it QUACKS-like-a duck, WALKS-like-a duck, etc, etc, depending on exactly what subset of duck-like behaviour you need...

Its funny how we advocate the same thing in Java in spite of being statically typed , when we talk about programming to interface not to implementation. As long as it QUACKS, WALKS like a duck, we shouldn't care about its type.

Labels