roam/20201008164244-duck_typing.org

19 lines
751 B
Org Mode
Raw Normal View History

2021-07-29 22:51:04 +00:00
:PROPERTIES:
:ID: c50025bd-6942-4a78-b448-ea6fda2925fd
:END:
2020-10-08 21:22:51 +00:00
#+title: Duck Typing
#+begin_quote
Duck typing in computer programming is an application of the duck test—"If it
walks like a duck and it quacks like a duck, then it must be a duck"—to
determine if an object can be used for a particular purpose. With normal typing,
suitability is determined by an object's type. In duck typing, an object's
suitability is determined by the presence of certain methods and properties,
rather than the type of the object itself.
--- https://en.wikipedia.org/wiki/Duck_typing
#+end_quote
2021-07-29 22:51:04 +00:00
This contrasts with [[id:c16eb203-290f-4644-8f18-725ffad15e92][Structural Typing]], where the type of the object itself is
2020-10-08 21:22:51 +00:00
used to determine its suitability.