Beautiful post

Products

  • structs in C
  • class in Java
  • records in scheme/lisp
  • Constructors in Haskell

Variants

  • Either, Maybe, Option - Scala/Haskell
  • Deconstruction using pattern match
  • tagged union in C
  • instanceof in java

Power of the ADT

  • The definition of ADT is close to problem domain.
  • The structure of solution using ADT has the same structure as definition itself.
  • Good for defining expressions, trees, parsers etc.