Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is OOP based on any branch of mathematics? [closed]

Tags:

oop

math

I know relational databases are based on set-theory, functional programming is based on lambda calculus, logic programming is based on logic (of course :)), and now that I think of it; I'm not sure if imperative and generic programming is based on any particular branch of mathematics either.

like image 272
ektrules Avatar asked Jun 05 '10 09:06

ektrules


People also ask

How is mathematics used in OOP?

Object oriented programming is particularly valuable in mathematics because of mathematicians' tendency to define new objects to contain our ideas. OOP allows us to define analogous objects in Python, and to describe their behaviors.

Is object-oriented programming dying?

Object-oriented programming has fulfilled many of its promises. Software systems today are longer-lived and more amenable to change and extension than ever. Nevertheless we observe that object orientation is slowly dying, with the introduction of ever more complex and heterogeneous systems.

When would you not use object-oriented programming?

These include: design patterns, abstraction, encapsulation, modularity, polymorphism, and inheritance. When not to use OOP: Putting square pegs in round holes: Don't wrap everything in classes when they don't need to be. Sometimes there is no need and the extra overhead just makes your code slower and more complex.


2 Answers

OOP does not originate from any strict formalism, but it is a formalism indeed. There were a number of attempts to define that formalism properly. Most notable work is done by Luca Cardelli: http://lucacardelli.name/indexPapers.html (see the whole "Objects" section)

Imperative programming could be based on any Turing-equivalent formalism, including lambda calculus, SK logic, Turing abstract machine, Markov algorithms, or any other similar Term Rewriting System (TRS). Generic programming is not any different, it is a term rewriting system of a sort.

So, for the most common mathematical grounds for literally everything you'd need to dig into term rewriting systems.

A more recent work is AbdelGawad's recent work at Rice University. He builds a mathematical model of mainstream OOP (eg, Java, C#, C++, Scala, X10, etc) called NOOP. Here is a link to his PhD thesis http://scholarship.rice.edu/handle/1911/70199

like image 61
SK-logic Avatar answered Oct 30 '22 11:10

SK-logic


OOP has its origins in programming languages like Simula-67 and Smalltalk-80, rather than any mathematical theory or formalism. But I suppose that you could say that OOP's object, class and inheritance concepts are based on naive or common-sense systems of categories and classification; e.g. the taxonomies developed by Linnaeus.

like image 22
Stephen C Avatar answered Oct 30 '22 12:10

Stephen C