title: Duck typing and (java) interface concept
body: <p>I just read the Wikipedia article about <a href="http://en.wikipedia.org/wiki/Duck_typing">duck typing</a>, and I feel like I miss an important point about the interface concept I used to in Java:</p>
  
  <pre><code>"When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck."
  
  
  class Duck:
      def quack(self):
          print("Quaaaaaack!")
      def feathers(self):
          print("The duck has white and gray feathers.")
      def swim(self):
          print("Swim seamlessly in the water")
  
  class Person:
      def quack(self):
          print("The person imitates a duck.")
      def feathers(self):
          print("The person takes a feather from the ground and shows it.")
      def name(self):
          print("John Smith")
  
  def in_the_forest(duck):
      duck.quack()
      duck.feathers()
  
  def game():
      donald = Duck()
      john = Person()
      in_the_forest(donald)
      in_the_forest(john)
  
  game()
  </code></pre>
  
  <p>what if, in <code>in_the_forest</code>, I write: </p>
  
  <ul>
  <li>does it <code>quack</code> like a duck ? yes</li>
  <li>does it have a duck <code>feathers</code> ? yes</li>
  <li>great, it's a duck we've got !</li>
  </ul>
  
  <p>and later, because I know it's a duck, I want it to <code>swim</code>? <code>john</code> will sink!</p>
  
  <p>I don't want my application to crash (randomly) in the middle of its process just because John faked to be a duck, but I guess it wouldn't be a wise idea to check every single attributes of the object when I receive it ... ?</p>