Paradigm: Object-oriented

Object-oriented programming (OOP) represents the program as a set of objects and their interactions. The fundamental concepts of OOP are:

  • an object is an elementary entity described with certain properties (stored in member attributes) and certain behaviour (implemented as member methods).
  • a class describes the structure of properties and behaviour of one objects type. Each object within a program is an instance of some class.
  • classes can inherit attributes and methods of thier parent class while adding their own ones. Classes hierarchy allows to model the entities of the problem on several levels of detail, and use the class which corresponds to detalization required by specific subproblem.
  • encapsulation means that some details of the class’ implementation are hidden from objects which interact with it. Each class has an interface which describes the way the objects of this class interact with other objects, and implementation which describes the effect of this interaction on the objects of this class.

Quite a lot of modern languages support OOP, though to a variable degree:

  • pure object-oriented languages, like Smalltalk and Ruby, are designed to support and even enforce OOP style and thus disallow any other style.
  • mostly object-oriented languages, like Java, C++ and Python, are designed mainly for OOP, but allow certain elements of procedural programming.
  • historically procedural languages, like Perl and Fortran 2002, have been extended to support some OOP features.
  • exotic languages, like Modula-2 and Oberon, implement certain features and principles of OOP, but in original form.

OOP can be opposed to modular or procedural programming: both objects and modules/subroutines are self-sufficient (to some extent) units, but objects focus on data contained in them, while modules focus on their functioning.

Programming languages that support this paradigm: