Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Theory behind object oriented programming

Tags:

oop

Alonzo Church's lambda calculus is the mathematical theory behind functional languages. Has object oriented programming some formal theory ?

like image 265
Tinku Avatar asked Jun 24 '10 19:06

Tinku


People also ask

What is the concept of object-oriented programming?

OOP (Object-oriented programming) is a programming paradigm based on the concept of "objects", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).

What are the 3 principles of OOP?

Object-Oriented Principles. Encapsulation, inheritance, and polymorphism are usually given as the three fundamental principles of object-oriented languages (OOLs) and object-oriented methodology. These principles depend somewhat on the type of the language.

What are the 4 main principles of object-oriented programming?

Object-oriented programming has four basic concepts: encapsulation, abstraction, inheritance and polymorphism. While these concepts may seem complex, understanding the general framework of how they work will help you understand the basics of an OOP computer program.

Which was the first theory of object oriented programming language?

Explanation: SmallTalk was the first programming language developed which was purely object oriented. It was developed by Alan Kay.


2 Answers

Object Orientation comes from psychology not math.

If you think about it, it resembles more how humans work than how computers work. We think in objects that we class-ify. For instance this table is a seating furniture.

Take Jean Piaget (1896-1980), who worked on a theory of children's cognitive development. Wikipedia says:

Piaget also had a considerable effect in the field of computer science and artificial intelligence.

Some cognitive concepts he discovered (that imply to the Object Orientation concept):

Classification The ability to group objects together on the basis of common features.

Class Inclusion The understanding, more advanced than simple classification, that some classes or sets of objects are also sub-sets of a larger class. (E.g. there is a class of objects called dogs. There is also a class called animals. But all dogs are also animals, so the class of animals includes that of dogs)

Read more: Piaget's developmental theory http://www.learningandteaching.info/learning/piaget.htm#ixzz1CipJeXyZ

like image 107
Roland Kofler Avatar answered Oct 12 '22 18:10

Roland Kofler


OOP is a bit of a mixed bag of features that various languages implement in slightly different ways. There is no single formal definition of OOP but a number of people have tried to describe OOP based on the common features of languages that claim to be object oriented. From Wikipedia:

Benjamin Cuire Pierce and some other researchers view as futile any attempt to distill OOP to a minimal set of features. He nonetheless identifies fundamental features that support the OOP programming style in most object-oriented languages:

  • Dynamic dispatch – when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an abstract data type (or module), which has a fixed (static) implementation of the operations for all instances. It is a programming methodology that gives modular component development while at the same time being very efficient.
  • Encapsulation (or multi-methods, in which case the state is kept separate)
  • Subtype polymorphism
  • object inheritance (or delegation)
  • Open recursion – a special variable (syntactically it may be a keyword), usually called this or self, that allows a method body to invoke another method body of the same object. This variable is late-bound; it allows a method defined in one class to invoke another method that is defined later, in some subclass thereof.
like image 35
Mark Byers Avatar answered Oct 12 '22 19:10

Mark Byers