All languages

Object-oriented paradigm

Programming languages organized around objects that bundle state with the procedures that operate on it, combined through inheritance and late binding. Introduced in SIMULA 67 (1967) and named by Alan Kay; still the dominant style of large-scale software.

Overview

Object-oriented programming organizes a program around objects that bundle state with the procedures that act on it, combined through inheritance and late binding. SIMULA 67 introduced that combination in 1967, Alan Kay coined the term around the same time, and the style remains the dominant way large systems are structured.

Its canonical languages run from Smalltalk through Java to C#.

Code

" an object bundles state with the messages that operate on it.
Object subclass: Account [
  | balance |
  Account class >> new [
    | r |
    r := super new.
    r init.
    ^r
  ]
  init [ balance := 0 ]
  deposit: amount [ balance := balance + amount ]
  spend: amount   [ balance := balance - amount ]
  printOn: stream [
    super printOn: stream.
    stream nextPutAll: ' with balance: '.
    balance printOn: stream
  ]
]
The tour runs across the paradigm's own lineage - Smalltalk's message-sending objects and its printOn: protocol, Java's class-and- subclass specification, then C#'s virtual dispatch for late binding.

Distinctive traits

  • Objects own their state. Bundling data with the procedures that act on it stops one part of a program from silently changing another's data.
  • Late binding buys substitutability. A message reaches whichever implementation answers it, so a new subtype works without editing its users.
  • Classes are not essential. Rideau treats a class as a compile-time prototype for a type, making class-based object orientation a special case.
  • Kay's definition was messaging, not encapsulation: messaging, local retention of state, and extreme late binding of everything.
  • The consensus definition is the SIMULA trio: encapsulation, inheritance with late binding, and dynamic creation of objects at run time.
  • The definition is contested, not settled. Rideau argues encapsulation covers only half of object orientation, and that message passing is not essential to it.

Status

Still dominant, and contested. Object orientation structures most large systems, but its definition remains disputed: whether encapsulation, classes, or message passing is essential, and whether it should replace functional programming rather than merely combine with it.

History

Dahl and Nygaard began SIMULA in 1961 as a simulation language; SIMULA 67, completed in 1967, introduced classes, subclasses, late binding, and dynamic object creation. Kay, working at Utah and later Xerox PARC, coined "object-oriented programming" around 1967 and built Smalltalk on that idea, leaving inheritance out at first. Stroustrup carried SIMULA's philosophy to C++ systems programmers around 1980, and Gosling's Java followed in the 1990s.

Languages using this paradigm (28)

Sources & references