Object-oriented programming: Difference between revisions

Content deleted Content added
m top: Fixed typo
Tags: canned edit summary Mobile edit Mobile app edit Android app edit
mNo edit summary
 
(226 intermediate revisions by more than 100 users not shown)
Line 1:
{{short description|Programming paradigm based on the concept of objects}}
{{Redirect|Object-oriented|other meanings of object-oriented|Object-orientation}}
{{redirect|Object-oriented programming language|a list of object-oriented programming languages|List of object-oriented programming languages}}
{{Use dmy dates|date=January 2020}}
[[File:Oop-uml-class-example.svg|frame|right|[[UML]] notation for a class. This Button class has [[Variable (computer science)|variables]] for data, and [[Method (computer programming)|functions]]. Through inheritance, a subclass can be created as a subset of the Button class. Objects are instances of a class.]]
{{Programming paradigms}}
 
'''Object-oriented programming''' ('''OOP''') is a [[programming paradigm]] based on the concept of "[[Object (computer science)|objectsobject]]",<ref whichname=alanKayOnOO/> can containa [[datasoftware]] andentity that [[Computerencapsulation program(programming)|codeencapsulates]]. The [[data]] is in the form ofand [[FieldFunction (computer scienceprogramming)|fieldsfunction(s)]]. (oftenAn known asOOP [[Attributecomputer (computing)|attributesprogram]] or ''properties''), and the code is in the formconsists of proceduresobjects (oftenthat knowninteract aswith ''[[Methodone (computer science)|methods]]'')another.<ref>{{Cite journal
|last1=Kindler |first1=E.
|last2=Krivy |first2=I.
|year=2011
|title=Object-Oriented Simulation of systems with sophisticated control
|journal=International Journal of General Systems
|volume=40
|issue=3
|pages=313–343 |doi=10.1080/03081079.2010.539975
}}</ref><ref>{{Cite book |last1=Lewis |first1=John |last2=Loftus |first2=William |year=2008 |chapter=1.6: Object-Oriented Programming |title=Java Software Solutions |series=Foundations of Programming Design |edition=6th |publisher=Pearson Education Inc. |isbn=978-0-321-53205-3}}</ref> A [[programming language]] that provides OOP features is classified as an ''OOP language'' but as the set of features that contribute to OOP is contended, classifying a language as OOP and the degree to which it supports or is OOP, are debatable. As paradigms are not mutually exclusive, a language can be [[multi-paradigm]]; can be categorized as more than only OOP.
 
Sometimes, objects represent real-world things and processes in digital form.<ref>{{cite book |last1=Booch |first1=Grady |author1-link=Grady Booch |year=1986 |title=Software Engineering with Ada |publisher=Addison Wesley |isbn=978-0-8053-0608-8 |page=220 |url=https://en.wikiquote.org/wiki/Grady_Booch |quote=Perhaps the greatest strength of an object-oriented approach to development is that it offers a mechanism that captures a model of the real world.}}</ref> For example, a graphics program may have objects such as {{code|circle}}, {{code|square}}, and {{code|menu}}. An online shopping system might have objects such as {{code|shopping cart}}, {{code|customer}}, and {{code|product}}. [[Niklaus Wirth]] said, "This paradigm [OOP] closely reflects the structure of systems in the real world and is therefore well suited to model complex systems with complex behavior".<ref>{{cite journal
A common feature of objects is that procedures (or methods) are attached to them and can access and modify the object's data fields. In this brand of OOP, there is usually a special name such as [[this (computer programming)|{{code|this|C++}}]] or {{code|self|swift}} used to refer to the current object. In OOP, computer programs are designed by making them out of objects that interact with one another.<ref>{{Cite journal
| last1 = KindlerWirth | first1=Niklaus |author1-link=Niklaus E.Wirth
|journal=[[IEEE Computer]]
| last2 = Krivy | first2 = I.
|volume=39
| title = Object-Oriented Simulation of systems with sophisticated control
|issue=1
| publisher = International Journal of General Systems
|date=January 23, 2006
| year = 2011 | pages = 313–343}}</ref><ref>{{Cite book|last1=Lewis|first1=John|last2=Loftus|first2= William|title=Java Software Solutions Foundations of Programming Design 6th ed|publisher=Pearson Education Inc.|year=2008|isbn=978-0-321-53205-3}}, section 1.6 "Object-Oriented Programming"</ref> OOP languages are diverse, but the most popular ones are [[Class-based programming|class-based]], meaning that objects are [[instance (computer science)|instances]] of [[class (computer science)|classes]], which also determine their [[data type|types]].
|pages=28–39
|title=Good ideas, through the looking glass
|series=Cover Feature
|doi=10.1109/MC.2006.20
|s2cid=6582369
|url=https://pdfs.semanticscholar.org/10bd/dc49b85196aaa6715dd46843d9dcffa38358.pdf |archive-url=https://web.archive.org/web/20161012215755/https://pdfs.semanticscholar.org/10bd/dc49b85196aaa6715dd46843d9dcffa38358.pdf |url-status=dead |archive-date=12 October 2016
}}</ref>
 
However, more often, objects represent abstract entities, like an open file or a unit converter. Not everyone agrees that OOP makes it easy to copy the real world exactly or that doing so is even necessary. [[Robert C. Martin|Bob Martin]] suggests that because classes are software, their relationships don't match the real-world relationships they represent.<ref>{{cite web |url=https://www.youtube.com/watch?v=zHiWqnTWsn4 |title=Uncle Bob SOLID principles |website=[[YouTube]] |date=2 August 2018}}</ref> [[Bertrand Meyer]] argues that a program is not a model of the world but a model of some part of the world; "Reality is a cousin twice removed".{{sfn|Meyer|1997|p=230}} [[Steve Yegge]] noted that [[natural language]]s lack the OOP approach of naming a thing (object) before an action (method), as opposed to [[functional programming]] which does the reverse.<ref name="executioniKoN">{{Cite web |last1=Yegge |first1=Steve |date=30 March 2006 |title=Execution in the Kingdom of Nouns |access-date=3 July 2010 |publisher=steve-yegge.blogspot.com |url=http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html}}</ref> This can make an OOP solution more complex than one written via [[procedural programming]].<ref name="executioniKoN2">{{Cite web |last1=Boronczyk |first1=Timothy |date=11 June 2009 |title=What's Wrong with OOP |url=http://zaemis.blogspot.com/2009/06/whats-wrong-with-oop.html |publisher=zaemis.blogspot.com |access-date=3 July 2010}}</ref>
Many of the most widely used programming languages (such as C++, Java, Python, etc.) are [[multi-paradigm programming language|multi-paradigm]] and they support object-oriented programming to a greater or lesser degree, typically in combination with [[imperative programming|imperative]], [[procedural programming]].
 
Significant object-orientedNotable languages with OOP support include: [[Ada (programming language)|Ada]], [[ActionScript]], [[C++]], [[Common Lisp]], [[C Sharp (programming language)|C#]], [[Dart (programming language)|Dart]], [[Eiffel (programming language)|Eiffel]], [[Fortran#Fortran_2003|Fortran 2003]], [[Haxe]], [[Java (programming language)|Java]],{{sfn|Bloch|2018|loc=Foreword|pp=xi-xii}} [[JavaScript]], [[Kotlin (programming language)|Kotlin]], [[Logo (programming language)|logoLogo]], [[MATLAB]], [[Objective-C]], [[Object Pascal]], [[Perl]], [[PHP]], [[Python (programming language)|Python]], [[R (programming language)|R,]], [[Raku (programming language)|Raku]], [[Ruby (programming language)|Ruby]], [[Scala (programming language)|Scala]], [[SIMSCRIPT]], [[Simula]], [[Smalltalk]], [[Swift (programming language)|Swift]], [[Vala (programming language)|Vala]] and [[Visual Basic (.NET)]].
 
==History==
[[File:oop-uml-class-example.png|frame|right|[[Unified Modeling Language|UML]] notation for a class. This Button class has [[Variable (computer science)|variables]] for data, and [[Method (computer programming)|functions]]. Through inheritance a subclass can be created as subset of the Button class. Objects are instances of a class.]]
 
The idea of "objects" in programming began with the [[artificial intelligence]] group at [[Massachusetts Institute of Technology]] (MIT) in the late 1950s and early 1960s. Here, "object" referred to [[Lisp (programming language)|LISP]] atoms with identified properties (attributes).<ref>{{Cite journal |last1=McCarthy |first1=J. |author1-link=John McCarthy (computer scientist) |last2=Brayton |first2=R. |last3=Edwards |first3=D. |last4=Fox |first4=P. |author4-link=Phyllis Fox |last5=Hodes |first5=L. |author5-link=Louis Hodes |last6=Luckham |first6=D. |author6-link=David Luckham |last7=Maling |first7=K. |last8=Park |first8=D. |author8-link=David Park (computer scientist) |last9=Russell |first9=S. |author9-link=Steve Russell (computer scientist) |date=March 1969 |title=LISP I Programmers Manual |url=http://history.siam.org/sup/Fox_1960_LISP.pdf |url-status=dead |journal=Computation Center and Research Laboratory of Electronics |publisher=Artificial Intelligence Group, [[M.I.T. Computation Center]] and Research Laboratory |page=88f |archive-url=https://web.archive.org/web/20100717111134/http://history.siam.org/sup/Fox_1960_LISP.pdf |archive-date=17 July 2010 |quote=In the local M.I.T. patois, association lists [of atomic symbols] are also referred to as "property lists", and atomic symbols are sometimes called "objects". |place=[[Boston]], [[Massachusetts]]}}</ref><ref>{{Cite book
Terminology invoking "objects" and "oriented" in the modern sense of object-oriented programming made its first appearance at [[MIT]] in the late 1950s and early 1960s. In the environment of the [[artificial intelligence]] group, as early as 1960, "object" could refer to identified items ([[Lisp (programming language)|LISP]] atoms) with properties (attributes);<ref>{{Cite journal
|last1=McCarthy
|first1=J.John
|author1-link=John McCarthy (computer scientist)
|last2=Brayton
|last2=Abrahams
|first2=R.
|first2=Paul W.
|author2-link=Robert Brayton (computer scientist)
|last3=Edwards
|first3=DDaniel J.
|last4=Hart
|author3-link=Daniel Edwards (programmer)
|first4=Swapnil D.
|last4=Fox
|first4last5=P.Levin
|first5=Michael I.
|author4-link=Phyllis Fox
|last5year=Hodes1962
|url=https://archive.org/details/lisp15programmer00john/page/105
|first5=L.
|title=LISP 1.5 Programmer's Manual
|author5-link=Louis Hodes
|publisher=[[MIT Press]]
|last6=Luckham
|page=[https://archive.org/details/lisp15programmer00john/page/105 105]
|first6=D.
|isbn=978-0-262-13011-0
|author6-link=David Luckham
|quote=Object – a synonym for atomic symbol
|last7=Maling
|df=dmy-all
|first7=K.
|author7-link=Klim Maling (programmer)
|last8=Park
|first8=D.
|author8-link=David Park (computer scientist)
|last9=Russell
|first9=S.
|author9-link=Steve Russell (computer scientist)
|title=LISP I Programmers Manual
|place=[[Boston]], [[Massachusetts]]
|publisher=Artificial Intelligence Group, [[M.I.T. Computation Center]] and Research Laboratory
|date=March 1969
|page=88f
|url=http://history.siam.org/sup/Fox_1960_LISP.pdf
|quote=In the local M.I.T. patois, association lists [of atomic symbols] are also referred to as "property lists", and atomic symbols are sometimes called "objects".
|url-status=dead
|archive-url=https://web.archive.org/web/20100717111134/http://history.siam.org/sup/Fox_1960_LISP.pdf
|archive-date=17 July 2010
}}</ref><ref>{{Cite book
|url = https://archive.org/details/lisp15programmer00john/page/105
|title = LISP 1.5 Programmer's Manual
|publisher = [[MIT Press]]
|first1 = John
|last1 = McCarthy
|author-link = John McCarthy (computer scientist)
|first2 = Paul W.
|last2 = Abrahams
|first3 = Daniel J.
|last3 = Edwards
|author3-link = Daniel Edwards (programmer)
|first4 = swapnil d.
|last4 = Hart
|first5 = Michael I.
|last5 = Levin
|isbn = 978-0-262-13011-0
|year = 1962
|page = [https://archive.org/details/lisp15programmer00john/page/105 105]
|quote = Object&nbsp;— a synonym for atomic symbol
|df = dmy-all
}}</ref>
Another early example was [[Sketchpad]] created by [[Ivan Sutherland]] at MIT in 1960–1961. In the glossary of his technical report, Sutherland defined terms like "object" and "instance" (with the class concept covered by "master" or "definition"), albeit specialized to graphical interaction.<ref>{{cite conference
[[Alan Kay]] later cited a detailed understanding of LISP internals as a strong influence on his thinking in 1966.<ref name=alanKayOnOO>{{Cite web|url= http://www.purl.org/stefan_ram/pub/doc_kay_oop_en |title=Dr. Alan Kay on the Meaning of "Object-Oriented Programming" |year= 2003|access-date=11 February 2010}}</ref>
|author=[[Ivan E. Sutherland]]
 
|title=Sketchpad: a man-machine graphical communication system
{{Quote box
|conference=AFIPS '63 (Spring): Proceedings of the May 21–23, 1963 Spring Joint Computer Conference
|quote = I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning – it took a while to see how to do messaging in a programming language efficiently enough to be useful).
|publisher=AFIPS Press
|author = Alan Kay
|date=May 1963
|source =<ref name=alanKayOnOO />
|pages=329–346
|width = 50%
|doi=10.1145/1461551.1461591|doi-access=free}}
</ref> Later, in 1968, AED-0, MIT's version of the [[ALGOL]] programming language, connected data structures ("plexes") and procedures, prefiguring what were later termed "messages", "methods", and "member functions".<ref name=simuladev>{{cite journal
|last1=Nygaard |first1=Kristen |author1-link=Kristen Nygaard
|last2=Dahl |first2=Ole-Johan |author2-link=Ole-Johan Dahl
|date=August 1, 1978
|title=The development of the SIMULA languages
|journal=[[ACM SIGPLAN Notices]]
|volume=13
|issue=8
|pages=245–272
|doi=10.1145/960118.808391
|doi-access=free
}}
 
Another early MIT example was [[Sketchpad]] created by [[Ivan Sutherland]] in 1960–1961; in the glossary of the 1963 technical report based on his dissertation about Sketchpad, Sutherland defined notions of "object" and "instance" (with the class concept covered by "master" or "definition"), albeit specialized to graphical interaction.<ref>{{Cite web|url=http://handle.dtic.mil/100.2/AD404549|archive-url=https://web.archive.org/web/20130408133119/http://handle.dtic.mil/100.2/AD404549|url-status=dead|archive-date=8 April 2013|title=Sketchpad: A Man-Machine Graphical Communication System|author=Sutherland, I. E.|date=30 January 1963|publisher=Technical Report No. 296, Lincoln Laboratory, Massachusetts Institute of Technology via Defense Technical Information Center (stinet.dtic.mil)|access-date=17 July 2019}}<!-- Seems to be fixed --></ref>
Also, an MIT [[ALGOL]] version, AED-0, established a direct link between data structures ("plexes", in that dialect) and procedures, prefiguring what were later termed "messages", "methods", and "member functions".<ref name=simuladev>
The Development of the Simula Languages,
[[Kristen Nygaard]], [[Ole-Johan Dahl]],
p.254
[http://cs-exhibitions.uni-klu.ac.at/fileadmin/template/documents/text/The_development_of_the_simula_languages.pdf Uni-kl.ac.at]
</ref><ref>
{{Cite web
|last last1= Ross |first first1= Doug
|title = The first software engineering language
|work = LCS/AI Lab Timeline
|publisher = MIT Computer Science and Artificial Intelligence Laboratory
|url = http://www.csail.mit.edu/timeline/timeline.php?query=event&id=19
|access-date =13 May 2010 }}
</ref>
Topics such as [[data abstraction]] and [[modular programming]] were common points of discussion at this time.
 
Meanwhile, in Norway, [[Simula]] introducedwas importantdeveloped conceptsduring thatthe areyears today1961–1967.<ref anname=simuladev/> essentialSimula partintroduced ofessential object-oriented programmingideas, such as [[Class (computer programming)|class]] and [[Object (computer science)|objectclasses]], inheritance, and [[Dynamic binding (computing)|dynamic binding]].<ref name="auto">{{Cite journal|last last1= Holmevik|first first1= Jan Rune|title = Compiling Simula: A historical study of technological genesis|journal = [[IEEE Annals of the History of Computing]]|volume = 16|issue = 4|pages = 25–37|year date=Winter 1994|url = http://www.idi.ntnu.no/grupper/su/publ/simula/holmevik-simula-ieeeannals94.pdf |doi = 10.1109/85.329756 |s2cid =18148999 18148999|access-date = 3 March 2018 |archive-date = 30 August 2017 |archive-url = https://web.archive.org/web/20170830065454/http://www.idi.ntnu.no/grupper/su/publ/simula/holmevik-simula-ieeeannals94.pdf |url-status = dead}}</ref>
The object-oriented Simula programming language was used mainly by researchers involved with [[physical modelling]], such as models to study and improvelike the movement of ships and their content through cargo ports.<ref name="auto"/> Simula is generally accepted as being the first language with the primary features and framework of an object-oriented language.<ref>{{cite journal |last1=Madsen |first1=Ole Lehrman |title=Kristen Nygaard |journal=A.M. Turing Award Laureates |url=https://amturing.acm.org/award_winners/nygaard_5916220.cfm |access-date=4 February 2025}}</ref>
 
{{Quote box
In the 1970s, the first version of the [[Smalltalk]] programming language was developed at [[Xerox PARC]] by [[Alan Kay]], [[Dan Ingalls]] and [[Adele Goldberg (computer scientist)|Adele Goldberg]]. Smalltalk-72 included a programming environment and was [[Dynamic programming|dynamically typed]], and at first was [[Interpreter (computing)|interpreted]], not [[Compiler|compiled]]. Smalltalk became noted for its application of object orientation at the language-level and its graphical development environment. Smalltalk went through various versions and interest in the language grew.<ref name="Bertrand Meyer 2009 329">{{Cite book|title=Touch of Class: Learning to Program Well with Objects and Contracts|author=Bertrand Meyer|publisher=Springer Science & Business Media|year=2009|isbn=978-3-540-92144-8|pages=329|bibcode=2009tclp.book.....M}}</ref> While Smalltalk was influenced by the ideas introduced in Simula 67 it was designed to be a fully dynamic system in which classes could be created and modified dynamically.<ref name="st">{{Cite web|first=Alan |last=Kay |url=http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html |title=The Early History of Smalltalk |access-date=13 September 2007 |url-status=dead |archive-url=https://web.archive.org/web/20080710144930/http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html |archive-date=10 July 2008 }}</ref>
|quote=I thought of objects being like biological cells and/or individual computers on a network, only able to communicate with messages (so messaging came at the very beginning – it took a while to see how to do messaging in a programming language efficiently enough to be useful).
|author=Alan Kay
|source=<ref name=alanKayOnOO/>
|width=50%
}}
 
Influenced by both MIT and Simula, [[Alan Kay]] began developing his own ideas in November 1966. He would go on to create [[Smalltalk]], an influential OOP language. By 1967, Kay was already using the term "object-oriented programming" in conversation.<ref name=alanKayOnOO/> Although sometimes called the "father" of OOP,<ref>{{cite book |last1=Butcher |first1=Paul |title=Seven Concurrency Models in Seven Weeks: When Threads Unravel |date=30 June 2014 |publisher=Pragmatic Bookshelf |isbn=978-1-68050-466-8 |page=204 |url=https://books.google.com/books?id=Xg9QDwAAQBAJ&pg=PT204 |language=en}}</ref> Kay has said his ideas differ from how OOP is commonly understood, and has implied that the computer science establishment did not adopt his notion.<ref name=alanKayOnOO>{{Cite web |url=http://www.purl.org/stefan_ram/pub/doc_kay_oop_en |title=Dr. Alan Kay on the Meaning of "Object-Oriented Programming" |year=2003 |access-date=11 February 2010}}</ref>
In the 1970s, Smalltalk influenced the [[Lisp (programming language)#Language innovations|Lisp community]] to incorporate [[Lisp (programming language)#Object systems|object-based techniques]] that were introduced to developers via the [[Lisp machine]]. Experimentation with various extensions to Lisp (such as LOOPS and [[Flavors (programming language)|Flavors]] introducing [[multiple inheritance]] and [[mixins]]) eventually led to the [[Common Lisp Object System]], which integrates functional programming and object-oriented programming and allows extension via a [[Meta-object protocol]]. In the 1980s, there were a few attempts to design processor architectures that included hardware support for objects in memory but these were not successful. Examples include the [[Intel iAPX 432]] and the [[Linn Products|Linn Smart]] [[Rekursiv]].
A 1976 MIT memo co-authored by [[Barbara Liskov]] lists [[Simula 67]], [[CLU (programming language)|CLU]], and [[Alphard (programming language)|Alphard]] as object-oriented languages, but does not mention Smalltalk.<ref>{{cite tech report |last1=Jones |first1=Anita K. |last2=Liskov|first2=Barbara H. |date=April 1976 |title=An Access Control Facility for Programming Languages |institution=MIT |number=CSG Memo 137|url=http://csg.csail.mit.edu/CSGArchives/memos/Memo-137.pdf}}</ref>
 
In the 1970s, the first version of the [[Smalltalk]] programming language was developed at [[Xerox PARC]] by [[Alan Kay]], [[Dan Ingalls]] and [[Adele Goldberg (computer scientist)|Adele Goldberg]]. Smalltalk-72 was notable for use of objects at the language level and its graphical development environment.<ref name="Bertrand Meyer 2009 329">{{Cite book|title=Touch of Class: Learning to Program Well with Objects and Contracts|author=Bertrand Meyer|publisher=Springer Science & Business Media|year=2009|isbn=978-3-540-92144-8|pages=329|bibcode=2009tclp.book.....M}}</ref> Smalltalk was a fully dynamic system, allowing users to create and modify classes as they worked.<ref>{{cite journal
In 1981, Goldberg edited the August issue of [[Byte Magazine]], introducing Smalltalk and object-oriented programming to a wider audience. In 1986, the [[Association for Computing Machinery]] organised the first ''Conference on Object-Oriented Programming, Systems, Languages, and Applications'' (OOPSLA), which was unexpectedly attended by 1,000 people. In the mid-1980s [[Objective-C]] was developed by [[Brad Cox]], who had used Smalltalk at [[ITT Inc.]], and [[Bjarne Stroustrup]], who had used Simula for his PhD thesis, eventually went to create the object-oriented [[C++]].<ref name="Bertrand Meyer 2009 329"/> In 1985, [[Bertrand Meyer]] also produced the first design of the [[Eiffel (programming language)|Eiffel language]]. Focused on software quality, Eiffel is a purely object-oriented programming language and a notation supporting the entire software lifecycle. Meyer described the Eiffel software development method, based on a small number of key ideas from software engineering and computer science, in [[Object-Oriented Software Construction]]. Essential to the quality focus of Eiffel is Meyer's reliability mechanism, [[Design by Contract]], which is an integral part of both the method and language.
|title=The early history of Smalltalk
|author=[[Alan C. Kay]]
|journal=[[ACM SIGPLAN Notices]]
|volume=28
|issue=3
|pages=69–95
|date=March 1993
|doi=10.1145/155360.155364
|doi-access=free
}}
</ref> Much of the theory of OOP was developed in the context of Smalltalk, for example multiple inheritance.<ref>{{cite report |last1=Borning |first1=Alan Hamilton |date=1979 |title=Thinglab: a constraint-oriented simulation laboratory |url=https://constraints.cs.washington.edu/ui/thinglab-tr.pdf |publisher=Stanford University}}</ref>
 
In the late 1970s and 1980s, OOP rose to prominence. The [[Flavors (programming language)|Flavors]] object-oriented Lisp was developed starting 1979, introducing [[multiple inheritance]] and [[mixin]]s.<ref>{{cite conference |last1=Moon |first1=David A. |author1-link=David A. Moon |date=June 1986 |title=Object-Oriented Programming with Flavors |book-title=Conference proceedings on Object-oriented Programming Systems Languages and Applications |pages=1–8 |isbn=978-0-89791-204-4 |conference=[[OOPSLA]] '86 |doi=10.1145/28697.28698 |s2cid=17150741 |url=https://www.cs.tufts.edu/comp/150FP/archive/david-moon/flavors.pdf |access-date=2022-03-17}}</ref> In August 1981, [[Byte Magazine]] highlighted Smalltalk and OOP, introducing these ideas to a wide audience.<ref>{{cite news |title=Introducing the Smalltalk Zoo |url=https://computerhistory.org/blog/introducing-the-smalltalk-zoo-48-years-of-smalltalk-history-at-chm/ |work=CHM |date=17 December 2020 |language=en}}</ref> LOOPS, the object system for [[Interlisp]]-D, was influenced by Smalltalk and Flavors, and a paper about it was published in 1982.<ref>{{cite conference |title=LOOPS: data and object oriented Programming for Interlisp|date=1982|conference=European AI Conference|last1=Bobrow|first1=D. G.|last2=Stefik|first2=M. J|url=https://www.markstefik.com/wp-content/uploads/2011/04/1982-Bobrow-Stefik-Data-Object-Pgming.pdf}}</ref> In 1986, the first ''Conference on Object-Oriented Programming, Systems, Languages, and Applications'' ([[OOPSLA]]) was attended by 1,000 people. This conference marked the start of efforts to consolidate Lisp object systems, eventually resulting in the [[Common Lisp Object System]]. In the 1980s, there were a few attempts to design [[Processor design|processor architectures]] that included [[Computer hardware|hardware]] support for objects in [[Computer memory|memory]], but these were not successful. Examples include the [[Intel iAPX 432]] and the [[Linn Products|Linn Smart]] [[Rekursiv]].
[[File:Tiobeindex.png|thumb|350px|The [[TIOBE index|TIOBE]] [[Measuring programming language popularity|programming language popularity index]] graph from 2002 to 2018. In the 2000s the object-oriented [[Java (programming language)|Java]] (green) and the [[Procedural programming|procedural]] [[C (programming language)|C]] (black) competed for the top position.]]
In the early and mid-1990s object-oriented programming developed as the dominant programming [[paradigm]] when programming languages supporting the techniques became widely available. These included Visual [[FoxPro]] 3.0,<ref>1995 (June) Visual [[FoxPro]] 3.0, FoxPro evolves from a procedural language to an object-oriented language. Visual FoxPro 3.0 introduces a database container, seamless client/server capabilities, support for ActiveX technologies, and OLE Automation and null support. [http://www.foxprohistory.org/foxprotimeline.htm#summary_of_fox_releases Summary of Fox releases]</ref><ref>FoxPro History web site: [http://www.foxprohistory.org/tableofcontents.htm Foxprohistory.org]</ref><ref>1995 Reviewers Guide to Visual FoxPro 3.0: [http://www.dfpug.de/loseblattsammlung/migration/whitepapers/vfp_rg.htm DFpug.de]</ref> [[C++]],<ref>{{Cite book|url=https://books.google.com/books?id=MHmqfSBTXsAC&pg=PA16|title=Object Oriented Programming with C++, 1E|isbn=978-81-259-2532-3|last1=Khurana|first1=Rohit|date=1 November 2009}}</ref> and [[Delphi (programming language)|Delphi]]{{Citation needed|date=February 2010}}. Its dominance was further enhanced by the rising popularity of [[graphical user interface]]s, which rely heavily upon object-oriented programming techniques. An example of a closely related dynamic GUI library and OOP language can be found in the [[Cocoa (software)|Cocoa]] frameworks on [[Mac OS X]], written in [[Objective-C]], an object-oriented, dynamic messaging extension to C based on Smalltalk. OOP toolkits also enhanced the popularity of [[event-driven programming]] (although this concept is not limited to OOP).
 
In the mid-1980s, new object-oriented languages like [[Objective-C]], [[C++]], and [[Eiffel language|Eiffel]] emerged. Objective-C was developed by [[Brad Cox]], who had used Smalltalk at [[ITT Inc.]] [[Bjarne Stroustrup]] created [[C++]] based on his experience using Simula for his PhD thesis.<ref name="Bertrand Meyer 2009 329"/> [[Bertrand Meyer]] produced the first design of the [[Eiffel language]] in 1985, which focused on software quality using a [[design by contract]] approach.{{sfn|Meyer|1997}}
At [[ETH Zürich]], [[Niklaus Wirth]] and his colleagues had also been investigating such topics as [[data abstraction]] and [[modularity (programming)|modular programming]] (although this had been in common use in the 1960s or earlier). [[Modula-2]] (1978) included both, and their succeeding design, [[Oberon (programming language)|Oberon]], included a distinctive approach to object orientation, classes, and such.
 
In the 1990s, OOP became the main way of programming, especially as more languages supported it. These included [[Visual FoxPro]] 3.0,<ref>1995 (June) [[Visual FoxPro]] 3.0, FoxPro evolves from a procedural language to an object-oriented language. Visual FoxPro 3.0 introduces a database container, seamless client/server capabilities, support for ActiveX technologies, and OLE Automation and null support. [http://www.foxprohistory.org/foxprotimeline.htm#summary_of_fox_releases Summary of Fox releases]</ref><ref>1995 Reviewers Guide to Visual FoxPro 3.0: [http://www.dfpug.de/loseblattsammlung/migration/whitepapers/vfp_rg.htm DFpug.de]</ref> [[C++]],<ref>{{Cite book|url=https://books.google.com/books?id=MHmqfSBTXsAC&pg=PA16|title=Object Oriented Programming with C++, 1E|isbn=978-81-259-2532-3|last1=Khurana|first1=Rohit|date=1 November 2009|publisher=Vikas Publishing House Pvt Limited}}</ref> and [[Delphi (software)|Delphi]]{{Citation needed|date=February 2010}}. OOP became even more popular with the rise of [[graphical user interface]]s, which used objects for buttons, menus and other elements. One well-known example is Apple's [[Cocoa (software)|Cocoa]] framework, used on [[macOS]] and written in [[Objective-C]]. OOP toolkits also enhanced the popularity of [[event-driven programming]].{{Citation needed|date=February 2025}}
Object-oriented features have been added to many previously existing languages, including [[Ada (programming language)|Ada]], [[BASIC]], [[Fortran]], [[Pascal (programming language)|Pascal]], and [[COBOL]]. Adding these features to languages that were not initially designed for them often led to problems with compatibility and maintainability of code.
 
At [[ETH Zürich]], [[Niklaus Wirth]] and his colleagues created new approaches to OOP. [[Modula-2]] (1978) and [[Oberon (programming language)|Oberon]] (1987), included a distinctive approach to object orientation, classes, and type checking across module boundaries. Inheritance is not obvious in Wirth's design since his nomenclature looks in the opposite direction: It is called type extension and the viewpoint is from the parent down to the inheritor.
More recently, a number of languages have emerged that are primarily object-oriented, but that are also compatible with procedural methodology. Two such languages are [[Python (programming language)|Python]] and [[Ruby programming language|Ruby]]. Probably the most commercially important recent object-oriented languages are [[Java (programming language)|Java]], developed by [[Sun Microsystems]], as well as [[C Sharp (programming language)|C#]] and [[Visual Basic.NET]] (VB.NET), both designed for Microsoft's [[.NET Framework|.NET]] platform. Each of these two frameworks shows, in its own way, the benefit of using OOP by creating an abstraction from implementation. VB.NET and C# support cross-language inheritance, allowing classes defined in one language to subclass classes defined in the other language.
 
Many programming languages that were initially developed before OOP was popular have been augmented with object-oriented features, including [[Ada (programming language)|Ada]], [[BASIC]], [[Fortran]], [[Pascal (programming language)|Pascal]], and [[COBOL]].
==Features==
Object-oriented programming uses objects, but not all of the associated techniques and structures are supported directly in languages that claim to support OOP. It performs operations on operands. The features listed below are common among languages considered to be strongly class- and object-oriented (or [[multi-paradigm]] with OOP support), with notable exceptions mentioned.<ref name="ArmstrongQuarks">Deborah J. Armstrong. ''The Quarks of Object-Oriented Development''. A survey of nearly 40 years of computing literature which identified a number of fundamental concepts found in the large majority of definitions of OOP, in descending order of popularity: Inheritance, Object, Class, Encapsulation, Method, Message Passing, Polymorphism, and Abstraction.</ref><ref>[[John C. Mitchell]], ''Concepts in programming languages'', Cambridge University Press, 2003, {{ISBN|0-521-78098-5}}, p.278. Lists: Dynamic dispatch, abstraction, subtype polymorphism, and inheritance.</ref><ref>Michael Lee Scott, ''Programming language pragmatics'', Edition 2, Morgan Kaufmann, 2006, {{ISBN|0-12-633951-1}}, p. 470. Lists encapsulation, inheritance, and dynamic dispatch.</ref><ref name="pierce">{{Cite book|last=Pierce|first=Benjamin|title=Types and Programming Languages|publisher=MIT Press|year=2002|isbn=978-0-262-16209-8|title-link=Types and Programming Languages}}, section 18.1 "What is Object-Oriented Programming?" Lists: Dynamic dispatch, encapsulation or multi-methods (multiple dispatch), subtype polymorphism, inheritance or delegation, open recursion ("this"/"self")</ref>
 
==Features==
{{Anchor|Object-oriented source code}}
{{See also|Comparison of programming languages (object-oriented programming)|List of object-oriented programming terms}}
The OOP features provided by languages varies. Below are some common features of OOP languages.<ref name="ArmstrongQuarks">Deborah J. Armstrong. ''The Quarks of Object-Oriented Development''. A survey of nearly 40 years of computing literature identified several fundamental concepts found in the large majority of definitions of OOP, in descending order of popularity: Inheritance, Object, Class, Encapsulation, Method, Message Passing, Polymorphism, and Abstraction.</ref><ref>[[John C. Mitchell]], ''Concepts in programming languages'', Cambridge University Press, 2003, {{ISBN|0-521-78098-5}}, p.278. Lists: Dynamic dispatch, abstraction, subtype polymorphism, and inheritance.</ref><ref>Michael Lee Scott, ''Programming language pragmatics'', Edition 2, Morgan Kaufmann, 2006, {{ISBN|0-12-633951-1}}, p. 470. Lists encapsulation, inheritance, and dynamic dispatch.</ref><ref name="pierce">{{Cite book|last1=Pierce|first1=Benjamin|title=Types and Programming Languages|publisher=MIT Press|year=2002|isbn=978-0-262-16209-8|title-link=Types and Programming Languages}}, section 18.1 "What is Object-Oriented Programming?" Lists: Dynamic dispatch, encapsulation or multi-methods (multiple dispatch), subtype polymorphism, inheritance or delegation, open recursion ("this"/"self")</ref> Comparing OOP with other styles, like [[relational programming]], is difficult because there isn't a clear, agreed-upon definition of OOP.<ref name="DatePage650">C. J. Date, Introduction to Database Systems, 6th-ed., Page 650</ref>
 
===Encapsulation===
===Shared with non-OOP languages===
An object [[Encapsulation (computer programming)|encapsulates]] [[Field (computer science) |fields]] and [[Method (computer programming) |method]]s. A field (a.k.a. attribute or property) contains information (a.k.a. state) as a [[variable (computer science) |variable]]. A method (a.k.a. [[function (programming) |function]] or action) defines behavior via logic code. Encapsulation is about keeping [[Cohesion (computer science)|related]], code together.
* [[Variable (computer science)|Variables]] that can store information formatted in a small number of built-in [[data type]]s like [[Integer (computer science)|integers]] and alphanumeric [[Character (computing)|characters]]. This may include [[data structures]] like [[String (computer science)|strings]], [[List (abstract data type)|lists]], and [[hash table]]s that are either built-in or result from combining variables using [[Pointer (computer programming)|memory pointers]].
* Procedures – also known as functions, methods, routines, or [[subroutine]]s – that take input, generate output, and manipulate data. Modern languages include [[structured programming]] constructs like [[Loop (computing)|loops]] and [[Conditional (computer programming)|conditionals]].
 
===Information hiding===
[[Modular programming]] support provides the ability to group procedures into files and modules for organizational purposes. Modules are [[namespace]]d so identifiers in one module will not conflict with a procedure or variable sharing the same name in another file or module.
[[Information hiding]] is organizing code so that it is accessible only to the code that needs it; not to the rest of the [[codebase]]. The internal details of an object are hidden from the outside code, allowing for changing how an object works without affecting its interface and therefore other code. Hiding information helps prevent problems when changing the code.<ref>{{Cite book |last1=McDonough |first1=James E. |title=Object-Oriented Design with ABAP: A Practical Approach |date=2017 |publisher=[[Apress]] |isbn=978-1-4842-2837-1 |___location= |chapter=Encapsulation |doi=10.1007/978-1-4842-2838-8 |via=[[O'Reilly Media|O'Reilly]]}}</ref> Objects act as a barrier between their internal workings and external, consuming code. Consuming code can only interact with an object via its public members.
 
Some programming languages, like Java, provide information hiding via visibility key words ({{code|private}} and {{code|public}}).{{sfn|Bloch|2018|loc=Chapter §4 Item15 Minimize the accessibility of classes and members|pp=73-77}} Some languages don't provide a visibility feature, but developers might follow a convention such as starting a private member name with an underscore. Intermediate levels of access also exist, such as Java's {{code|protected}} keyword, (which allows access from the same class and its subclasses, but not objects of a different class), and the {{code|internal}} keyword in C#, Swift, and Kotlin, which restricts access to files within the same module.<ref>{{Cite web |date=2023-01-05 |title=What is Object Oriented Programming (OOP) In Simple Words? – Software Geek Bytes |url=https://softwaregeekbytes.com/object-oriented-programming-simple-words/ |access-date=2023-01-17 |language=en-US}}{{Dead link|date=July 2025 |bot=InternetArchiveBot |fix-attempted=yes}}</ref>
===Objects and classes===
Languages that support object-oriented programming (OOP) typically use [[Inheritance (object-oriented programming)|inheritance]] for code reuse and extensibility in the form of either [[Class-based programming|classes]] or [[Prototype-based programming|prototypes]]. Those that use classes support two main concepts:
* [[Class (computer science)|Classes]] – the definitions for the data format and available procedures for a given type or class of object; may also contain data and procedures (known as class methods) themselves, i.e. classes contain the data members and member functions
* [[Object (computer science)|Objects]] – instances of classes
 
Supporters of information hiding and data abstraction say it makes code easier to reuse and intuitively represents real-world situations.<ref name="Luca1985">{{Cite journal |last1=Cardelli |first1=Luca |last2=Wegner |first2=Peter |date=1985-12-10 |title=On understanding types, data abstraction, and polymorphism |journal=ACM Computing Surveys |language=en |volume=17 |issue=4 |pages=471–523 |doi=10.1145/6041.6042 |issn=0360-0300|doi-access=free}}</ref><ref>{{cite book|last1=Jacobsen|first1=Ivar|title=Object Oriented Software Engineering|year=1992|publisher=Addison-Wesley ACM Press|isbn=978-0-201-54435-0|pages=[https://archive.org/details/objectorientedso00jaco/page/43 43–69]|author2=Magnus Christerson|author3=Patrik Jonsson|author4=Gunnar Overgaard|url=https://archive.org/details/objectorientedso00jaco/page/43}}</ref> However, others argue that OOP does not enhance readability or modularity.<ref name="badprop"/><ref name="armstrongjoe"/> [[Eric S. Raymond]] has written that OOP languages tend to encourage thickly layered programs that destroy transparency.<ref name="Eric S. Raymond 2003">{{cite web|url=http://www.catb.org/esr/writings/taoup/html/unix_and_oo.html|title=The Art of Unix Programming: Unix and Object-Oriented Languages|last1=Raymond|first1=Eric S.|date=2003|access-date=6 August 2014}}</ref> Raymond compares this unfavourably to the approach taken with [[Unix]] and the [[C (programming language)|C]] language.<ref name="Eric S. Raymond 2003"/>
Objects sometimes correspond to things found in the real world. For example, a graphics program may have objects such as "circle", "square", "menu". An online shopping system might have objects such as "shopping cart", "customer", and "product".<ref>{{cite book|last=Booch|first=Grady|title=Software Engineering with Ada|year=1986|publisher=Addison Wesley|isbn=978-0-8053-0608-8|page=220|url=https://en.wikiquote.org/wiki/Grady_Booch|quote=Perhaps the greatest strength of an object-oriented approach to development is that it offers a mechanism that captures a model of the real world.}}</ref> Sometimes objects represent more abstract entities, like an object that represents an open file, or an object that provides the service of translating measurements from U.S. customary to metric.
 
[[SOLID]] includes the [[open/closed principle]], which says that classes and functions should be "open for extension, but closed for modification". [[Luca Cardelli]] has stated that OOP languages have "extremely poor modularity properties with respect to class extension and modification", and tend to be extremely complex.<ref name="badprop"/> The latter point is reiterated by [[Joe Armstrong (programmer)|Joe Armstrong]], the principal inventor of [[Erlang (programming language)|Erlang]], who is quoted as saying:<ref name="armstrongjoe">{{cite book |last1=Armstrong |first1=Joe |author1-link=Joe Armstrong (programmer) |editor1-last=Seibel |editor1-first=Peter |title=Coders at Work: Reflections on the Craft of Programming |url=http://www.codersatwork.com/ |publisher=Codersatwork.com |archive-url=https://web.archive.org/web/20100305165150/http://www.codersatwork.com/ |archive-date=5 March 2010 |access-date=13 November 2009}}</ref>
Each object is said to be an [[instance (computer science)|instance]] of a particular class (for example, an object with its name field set to "Mary" might be an instance of class Employee). Procedures in object-oriented programming are known as [[Method (computer science)|methods]]; variables are also known as [[Field (computer science)|fields]], members, attributes, or properties. This leads to the following terms:
* [[Class variable]]s – belong to the ''class as a whole''; there is only one copy of each one
* [[Instance variable]]s or attributes – data that belongs to individual ''objects''; every object has its own copy of each one
* [[Member variable]]s – refers to both the class and instance variables that are defined by a particular class
* Class methods – belong to the ''class as a whole'' and have access to only class variables and inputs from the procedure call
* Instance methods – belong to ''individual objects'', and have access to instance variables for the specific object they are called on, inputs, and class variables
 
{{Blockquote|The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.}}
Objects are accessed somewhat like variables with complex internal structure, and in many languages are effectively [[Pointer (computer programming)|pointers]], serving as actual references to a single instance of said object in memory within a heap or stack. They provide a layer of [[Abstraction (computer science)|abstraction]] which can be used to separate internal from external code. External code can use an object by calling a specific instance method with a certain set of input parameters, read an instance variable, or write to an instance variable. Objects are created by calling a special type of method in the class known as a [[Constructor (object-oriented programming)|constructor]]. A program may create many instances of the same class as it runs, which operate independently. This is an easy way for the same procedures to be used on different sets of data.
 
Leo Brodie says that information hiding can lead to [[duplicate code]],<ref>{{Cite book |last1=Brodie |first1=Leo |year=1984 |url=https://thinking-forth.sourceforge.net/thinking-forth-ans.pdf |title=Thinking Forth |pages=92–93 |access-date=4 May 2018}}</ref> which goes against the [[don't repeat yourself]] rule of software development.<ref>{{cite web |work=Category Extreme Programming |last1=Hunt |first1=Andrew |url=http://wiki.c2.com/?DontRepeatYourself |title=Don't Repeat Yourself |access-date=4 May 2018}}</ref>
Object-oriented programming that uses classes is sometimes called [[class-based programming]], while [[prototype-based programming]] does not typically use classes. As a result, significantly different yet analogous terminology is used to define the concepts of ''object'' and ''instance''.
 
===Composition===
In some languages classes and objects can be composed using other concepts like [[Trait (computer programming)|traits]] and [[mixin]]s.
Via [[object composition]], an object can contain other objects. For example, an {{code|Employee}} object might contain an {{code|Address}} object, along with other information like {{code|name}} and {{code|position}}. Composition is a "has-a" relationships, like "an employee has an address".
 
===Inheritance===
===Class-based vs prototype-based===
[[Inheritance (object-oriented programming)|Inheritance]] be supported via the [[Class (computer programming)|class]] or the [[Prototype-based programming |prototype]], which have differences but use similar terms like object and [[instance (computer science)|instance]].
In [[Class-based programming|class-based languages]] the ''classes'' are defined beforehand and the ''objects'' are instantiated based on the classes. If two objects ''apple'' and ''orange'' are instantiated from the class ''Fruit'', they are inherently fruits and it is guaranteed that you may handle them in the same way; e.g. a programmer can expect the existence of the same attributes such as ''color'' or ''sugar_content'' or ''is_ripe''.
 
====Class-based====
In [[Prototype-based programming|prototype-based languages]] the ''objects'' are the primary entities. No ''classes'' even exist. The ''prototype'' of an object is just another object to which the object is linked. Every object has one ''prototype'' link (and only one). New objects can be created based on already existing objects chosen as their prototype. You may call two different objects ''apple'' and ''orange'' a fruit, if the object ''fruit'' exists, and both ''apple'' and ''orange'' have ''fruit'' as their prototype. The idea of the ''fruit'' class doesn't exist explicitly, but as the [[equivalence class]] of the objects sharing the same prototype. The attributes and methods of the ''prototype'' are [[Delegation (object-oriented programming)|delegated]] to all the objects of the equivalence class defined by this prototype. The attributes and methods ''owned'' individually by the object may not be shared by other objects of the same equivalence class; e.g. the attribute ''sugar_content'' may be unexpectedly not present in ''apple''. Only [[single inheritance]] can be implemented through the prototype.
 
In [[class-based programming]], the most common type of OOP, an object is an instance of a class. The class defines the data (variables) and methods (logic). An object is created via the [[Constructor (object-oriented programming)|constructor]]. Elements of class may include:
===Dynamic dispatch/message passing===
It is the responsibility of the object, not any external code, to select the procedural code to execute in response to a method call, typically by looking up the method at run time in a table associated with the object. This feature is known as [[dynamic dispatch]]. If the call variability relies on more than the single type of the object on which it is called (i.e. at least one other parameter object is involved in the method choice), one speaks of [[multiple dispatch]].
 
* [[Class variable]] – belongs to the class itself; all objects of the class share one copy
A method call is also known as ''[[message passing]]''. It is conceptualized as a message (the name of the method and its input parameters) being passed to the object for dispatch.
* [[Instance variable]] – belongs to an object; every object has its own version of these variables
* [[Member variable]] – refers to both the class and instance variables of a class
* Class method – can only use class variables
* Instance method – belongs to an objects; can use both instance and class variables
 
Classes may inherit from other classes, creating a hierarchy of classes: a case of a subclass inheriting from a super-class. For example, an {{code|Employee}} class might inherit from a {{code|Person}} class which endows the Employee object with the variables from {{code|Person}}. The subclass may add variables and methods that do not affect the super-class. Most languages also allow the subclass to override super-class methods. Some languages support [[multiple inheritance]], where a class can inherit from more than one class, and other languages similarly support [[mixin]]s or [[Trait (computer programming)|traits]]. For example, a mixin called UnicodeConversionMixin might add a method unicode_to_ascii() to both a FileReader and a WebPageScraper class.
===Data Abstraction===
Data Abstraction is a design pattern in which data are visible only to semantically related functions, so as to prevent misuse. The success of data abstraction leads to frequent incorporation of [[Information hiding|data hiding]] as a design principle in object oriented and pure functional programming.
 
An [[abstract class]] cannot be directly instantiated as an object. It is only used as a super-class.
If a class does not allow calling code to access internal object data and permits access through methods only, this is a form of information hiding known as [[Abstraction (computer science)|abstraction]]. Some languages (Java, for example) let classes enforce access restrictions explicitly, for example denoting internal data with the <code>private</code> keyword and designating methods intended for use by code outside the class with the <code>public</code> keyword. Methods may also be designed public, private, or intermediate levels such as <code>protected</code> (which allows access from the same class and its subclasses, but not objects of a different class). In other languages (like Python) this is enforced only by convention (for example, <code>private</code> methods may have names that start with an [[underscore]]).
 
Other classes are utility classes which contain only class variables and methods and are not meant to be instantiated or subclassed.{{sfn|Bloch|2018|loc=Chapter §2 Item 4 Enforce noninstantiability with a private constructor|p=19}}
===Encapsulation===
 
====Prototype-based====
[[Encapsulation (computer programming)|Encapsulation]] prevents external code from being concerned with the internal workings of an object. This facilitates [[code refactoring]], for example allowing the author of the class to change how objects of that class represent their data internally without changing any external code (as long as "public" method calls work the same way). It also encourages programmers to put all the code that is concerned with a certain set of data in the same class, which organizes it for easy comprehension by other programmers. Encapsulation is a technique that encourages [[Coupling (computer programming)|decoupling]].
Instead of providing a class concept, in [[prototype-based programming]], an object is linked to another object, called its ''prototype'' or ''parent''. In Self, an object may have multiple or no parents,<ref>{{cite book |chapter=Classifying prototype-based programming languages|chapter-url=https://www.lirmm.fr/~dony/postscript/proto-book.pdf|first1=C|last1=Dony|first2=J|last2=Malenfant|first3=D|last3=Bardon|title=Prototype-based programming: concepts, languages and applications |date=1999 |publisher=Springer |___location=Singapore Berlin Heidelberg |isbn=9789814021258}}</ref> but in the most popular prototype-based language, [[JavaScript]], an object has exactly one prototype link, up to the base object whose prototype is null.
 
A prototype acts as a model for new objects. For example, if you have an object {{code|fruit}}, you can make two objects {{code|apple}} and {{code|orange}} that share traits of the {{code|fruit}} prototype. Prototype-based languages also allow objects to have their own unique properties, so the {{code|apple}} object might have an attribute {{code|sugar_content}}, while the {{code|orange}} or {{code|fruit}} objects do not.
===Composition, inheritance, and delegation===
Objects can contain other objects in their instance variables; this is known as [[object composition]]. For example, an object in the Employee class might contain (either directly or through a pointer) an object in the Address class, in addition to its own instance variables like "first_name" and "position". Object composition is used to represent "has-a" relationships: every employee has an address, so every Employee object has access to a place to store an Address object (either directly embedded within itself, or at a separate ___location addressed via a pointer).
 
====No inheritance====
Languages that support classes almost always support [[inheritance (object-oriented programming)|inheritance]]. This allows classes to be arranged in a hierarchy that represents "is-a-type-of" relationships. For example, class Employee might inherit from class Person. All the data and methods available to the parent class also appear in the child class with the same names. For example, class Person might define variables "first_name" and "last_name" with method "make_full_name()". These will also be available in class Employee, which might add the variables "position" and "salary". This technique allows easy re-use of the same procedures and data definitions, in addition to potentially mirroring real-world relationships in an intuitive way. Rather than utilizing database tables and programming subroutines, the developer utilizes objects the user may be more familiar with: objects from their application ___domain.<ref>{{cite book|last=Jacobsen|first=Ivar|title=Object Oriented Software Engineering|year=1992|publisher=Addison-Wesley ACM Press|isbn=978-0-201-54435-0|pages=[https://archive.org/details/objectorientedso00jaco/page/43 43–69]|author2=Magnus Christerson|author3=Patrik Jonsson|author4=Gunnar Overgaard|url=https://archive.org/details/objectorientedso00jaco/page/43}}</ref>
Some languages, like [[Go (programming language)|Go]], don't support inheritance.<ref>{{Cite web |url=https://golang.org/doc/faq#Is_Go_an_object-oriented_language |title=Is Go an object-oriented language? |access-date=April 13, 2019 |quote=Although Go has types and methods and allows an object-oriented style of programming, there is no type hierarchy.}}</ref> Instead, they encourage "[[composition over inheritance]]", where objects are built using smaller parts instead of parent-child relationships. For example, instead of inheriting from class Person, the Employee class could simply contain a Person object. This lets the Employee class control how much of Person it exposes to other parts of the program. [[Delegation (object-oriented programming)|Delegation]] is another language feature that can be used as an alternative to inheritance.
 
Programmers have different opinions on inheritance. Bjarne Stroustrup, author of C++, has stated that it is possible to do OOP without inheritance.<ref>{{cite conference |last1=Stroustrup |first1=Bjarne |author1-link=Bjarne Stroustrup |title=Object-Oriented Programming without Inheritance (Invited Talk) |date=2015 |doi=10.4230/LIPIcs.ECOOP.2015.1 |doi-access=free |url=https://www.youtube.com/watch?v=xcpSLRpOMJM |conference=29th European Conference on Object-Oriented Programming (ECOOP 2015) |at=1:34}}</ref> [[Rob Pike]] has criticized inheritance for creating complex hierarchies instead of simpler solutions.<ref>{{cite web |url=http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |title=A few years ago I saw this page |last1=Pike |first1=Rob |access-date=1 October 2016 |date=14 November 2012|archive-url=https://web.archive.org/web/20180814173134/http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |archive-date=14 August 2018}}</ref>
Subclasses can override the methods defined by superclasses. [[Multiple inheritance]] is allowed in some languages, though this can make resolving overrides complicated. Some languages have special support for [[mixin]]s, though in any language with multiple inheritance, a mixin is simply a class that does not represent an is-a-type-of relationship. Mixins are typically used to add the same methods to multiple classes. For example, class UnicodeConversionMixin might provide a method unicode_to_ascii() when included in class FileReader and class WebPageScraper, which don't share a common parent.
 
====Inheritance and behavioral subtyping====
[[Abstract class]]es cannot be instantiated into objects; they exist only for the purpose of inheritance into other "concrete" classes that can be instantiated. In Java, the <code>[[final (Java)|final]]</code> keyword can be used to prevent a class from being subclassed.
People often think that if one class inherits from another, it means the subclass "[[is a]]" more specific version of the original class. This presumes the [[program semantics]] are that objects from the subclass can always replace objects from the original class without problems. This concept is known as [[behavioral subtyping]], more specifically the [[Liskov substitution principle]].
 
However, this is often not true, especially in programming languages that allow [[mutable]] objects, objects that change after they are created. In fact, [[subtype polymorphism]] as enforced by the [[type checker]] in OOP languages cannot guarantee behavioral subtyping in most if not all contexts. For example, the [[circle-ellipse problem]] is notoriously difficult to handle using OOP's concept of inheritance. Behavioral subtyping is undecidable in general, so it cannot be easily implemented by a compiler. Because of this, programmers must carefully design class hierarchies to avoid mistakes that the programming language itself cannot catch.
The doctrine of [[composition over inheritance]] advocates implementing has-a relationships using composition instead of inheritance. For example, instead of inheriting from class Person, class Employee could give each Employee object an internal Person object, which it then has the opportunity to hide from external code even if class Person has many public attributes or methods. Some languages, like [[Go (programming language)|Go]] do not support inheritance at all.
 
===Dynamic dispatch===
The "[[open/closed principle]]" advocates that classes and functions "should be open for extension, but closed for modification".
A method may be invoked via [[dynamic dispatch]] such that the method is selected at runtime instead of compile time. If the method choice depends on more than one type of object (such as other objects passed as parameters), it's called [[multiple dispatch]].
 
Dynamic dispatch works together with inheritance: if an object doesn't have the requested method, it looks up to its parent class ([[Delegation (object-oriented programming)|Delegationdelegation]]), isand anothercontinues languageup featurethe thatchain canto befind useda asmatching an alternative to inheritancemethod.
 
===Message passing===
[[Message passing]] is when the method name and its inputs are sent like a message to the object for it to act on.
 
===Polymorphism===
[[Polymorphism (computer science)|Polymorphism]] refers to [[subtyping]] or subtype polymorphism, where a function can work with a specific [[Interface (object-oriented programming)|interface]] and thus manipulate entities of different classes in a uniform manner.<ref>{{cite web |url=http://www.stroustrup.com/glossary.html#Gpolymorphism |last1=Stroustrup |first1=Bjarne |author1-link=Bjarne Stroustrup |title=Bjarne Stroustrup's C++ Glossary |date=February 19, 2007 |quote=polymorphism – providing a single interface to entities of different types.}}</ref>
[[Subtyping]] – a form of [[polymorphism (computer science)|polymorphism]] – is when calling code can be independent of which class in the supported hierarchy it is operating on – the parent class or one of its descendants. Meanwhile, the same operation name among objects in an inheritance hierarchy may behave differently.
 
For example, imagine a program has two shapes: a circle and a square. Both come from a common class called "Shape." Each shape has its own way of drawing itself. With subtype polymorphism, the program doesn't need to know the type of each shape, and can simply call the "Draw" method for each shape. The programming language runtime will ensure the correct version of the "Draw" method runs for each shape. Because the details of each shape are handled inside their own classes, this makes the code simpler and more organized, enabling strong [[separation of concerns]].
For example, objects of type Circle and Square are derived from a common class called Shape. The Draw function for each type of Shape implements what is necessary to draw itself while calling code can remain indifferent to the particular type of Shape being drawn.
 
This is another type of abstraction that simplifies code external to the class hierarchy and enables strong [[separation of concerns]].
 
===Open recursion===
In languages that support [[open recursion]], object methods can call other methods on the same object (including themselves), typically using a special variable or keyword called <code>this</code> or <code>self</code>. This variable is ''[[name binding|late-bound]]''; it allows a method defined in one class to invoke another method that is defined later, in some subclass thereof.
 
An object's methods can access the object's data. Many programming languages use a special word, like [[this (computer programming)|{{code|this|C++}}]] or {{code|self|swift}}, to refer to the current object. In languages that support [[open recursion]], a method in an object can call other methods in the same object, including itself, using this special word. This allows a method in one class to call another method defined later in a subclass, a feature known as [[late binding]].
==OOP languages==
{{Unreferenced section|date=August 2009}}
{{See also|List of object-oriented programming languages}}
 
==Design patterns==
[[Simula]] (1967) is generally accepted as being the first language with the primary features of an object-oriented language. It was created for making [[Computer simulation|simulation programs]], in which what came to be called objects were the most important information representation. [[Smalltalk]] (1972 to 1980) is another early example, and the one with which much of the theory of OOP was developed. Concerning the degree of object orientation, the following distinctions can be made:
[[Design pattern (computer science)|Design patterns]] are common solutions to problems in software design. Some design patterns are especially useful for OOP, and design patterns are typically introduced in an OOP context.
<!-- Order lists of examples based on [[TIOBE index]]-->
* Languages called "pure" OO languages, because everything in them is treated consistently as an object, from primitives such as characters and punctuation, all the way up to whole classes, prototypes, blocks, modules, etc. They were designed specifically to facilitate, even enforce, OO methods. Examples: [[Ruby (programming language)|Ruby]], [[Scala (programming language)|Scala]], [[Smalltalk]], [[Eiffel (programming language)|Eiffel]], [[Emerald (programming language)|Emerald]],<ref>{{cite web|url=http://www.emeraldprogramminglanguage.org/|title=The Emerald Programming Language| date=26 February 2011}}</ref> [[JADE (programming language)|JADE]], [[Self (programming language)|Self]], [[Raku (programming language)|Raku]].
* Languages designed mainly for OO programming, but with some procedural elements. Examples: [[Java (programming language)|Java]], [[Python (programming language)|Python]], [[C++]], [[C Sharp (programming language)|C#]], [[Delphi (programming language)|Delphi]]/[[Object Pascal]], [[VB.NET]].
* Languages that are historically [[Procedural programming|procedural languages]], but have been extended with some OO features. Examples: [[PHP]], [[Perl]], [[Visual Basic]] (derived from BASIC), [[MATLAB]], [[COBOL 2002]], [[Fortran 2003]], [[ABAP]], [[Ada (programming language)|Ada 95]], [[Pascal (programming language)|Pascal]].
* Languages with most of the features of objects (classes, methods, inheritance), but in a distinctly original form. Examples: [[Oberon (programming language)|Oberon]] (Oberon-1 or Oberon-2).
* Languages with [[abstract data type]] support which may be used to resemble OO programming, but without all features of object-orientation. This includes [[object-based|object-''based'']] and [[Prototype-based programming|prototype-based]] languages. Examples: [[JavaScript]], [[Lua (programming language)|Lua]], [[Modula-2]], [[CLU (programming language)|CLU]].
* Chameleon languages that support multiple paradigms, including OO. [[Tcl]] stands out among these for TclOO, a hybrid object system that supports both [[prototype-based programming]] and class-based OO.
 
===OOPObject in dynamic languagespatterns===
In recent years, object-oriented programming has become especially popular in [[dynamic programming language]]s. [[Python (programming language)|Python]], [[Windows PowerShell|PowerShell]], [[Ruby (programming language)|Ruby]] and [[Groovy (programming language)|Groovy]] are dynamic languages built on OOP principles, while [[Perl]] and [[PHP]] have been adding object-oriented features since Perl 5 and PHP 4, and [[ColdFusion]] since version 6.
 
The following are notable [[software design pattern]]s for OOP objects.<ref name="R.C.Martin">{{cite web |url=http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf |title=Design Principles and Design Patterns |last1=Martin |first1=Robert C. |author-link=Robert Cecil Martin |access-date=28 April 2017 |url-status=dead |archive-url=https://web.archive.org/web/20150906155800/http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf |archive-date=September 6, 2015}}</ref>
The [[Document Object Model]] of [[HTML]], [[XHTML]], and [[XML]] documents on the Internet has bindings to the popular [[JavaScript]]/[[ECMAScript]] language. JavaScript is perhaps the best known [[prototype-based programming]] language, which employs cloning from prototypes rather than inheriting from a class (contrast to [[class-based programming]]). Another scripting language that takes this approach is [[Lua (programming language)|Lua]].
 
*[[Function object]]: Class with one main method that acts like an [[anonymous function]] (in C++, the function operator, {{code|operator()}})
===OOP in a network protocol===
*[[Immutable object]]: does not change state after creation
The messages that flow between computers to request services in a client-server environment can be designed as the linearizations of objects defined by class objects known to both the client and the server. For example, a simple linearized object would consist of a length field, a code point identifying the class, and a data value. A more complex example would be a command consisting of the length and code point of the command and values consisting of linearized objects representing the command's parameters. Each such command must be directed by the server to an object whose class (or superclass) recognizes the command and is able to provide the requested service. Clients and servers are best modeled as complex object-oriented structures. [[Distributed Data Management Architecture]] (DDM) took this approach and used class objects to define objects at four levels of a formal hierarchy:
*[[First-class object]]: can be used without restriction
* Fields defining the data values that form messages, such as their length, code point and data values.
*[[Container object]]: contains other objects
* Objects and collections of objects similar to what would be found in a [[Smalltalk]] program for messages and parameters.
*[[Factory object]]: creates other objects
* Managers similar to [[IBM i]] [[Object (IBM i)|Object]]s, such as a directory to files and files consisting of metadata and records. Managers conceptually provide memory and processing resources for their contained objects.
*[[Metaobject]]: Used to create other objects (similar to a [[class (computer science)|class]], but an object)
* A client or server consisting of all the managers necessary to implement a full processing environment, supporting such aspects as directory services, security and concurrency control.
*[[Prototype pattern|Prototype object]]: a specialized metaobject that creates new objects by copying itself
*[[Singleton pattern|Singleton object]]: only instance of its class for the lifetime of the program
*[[Filter object]]: receives a stream of data as its input and transforms it into the object's output
 
A common [[anti-pattern]] is the [[God object]], an object that knows or does too much.
The initial version of DDM defined distributed file services. It was later extended to be the foundation of [[DRDA|Distributed Relational Database Architecture]] (DRDA).
 
==Design patterns==
Challenges of object-oriented design are addressed by several approaches. Most common is known as the [[Design Patterns (book)|design patterns codified by Gamma ''et al.'']]. More broadly, the term "[[design pattern (computer science)|design patterns]]" can be used to refer to any general, repeatable, solution pattern to a commonly occurring problem in software design. Some of these commonly occurring problems have implications and solutions particular to object-oriented development.
 
===Inheritance and behavioral subtyping===
{{See also|Object-oriented design}}<!-- not "further" because that article is mostly blather and does not even mention this -->
It is intuitive to assume that inheritance creates a [[program semantics|semantic]] "[[is a]]" relationship, and thus to infer that objects instantiated from subclasses can always be ''safely'' used instead of those instantiated from the superclass. This intuition is unfortunately false in most OOP languages, in particular in all those that allow [[mutable]] objects. [[Subtype polymorphism]] as enforced by the [[type checker]] in OOP languages (with mutable objects) cannot guarantee [[behavioral subtyping]] in any context. Behavioral subtyping is undecidable in general, so it cannot be implemented by a program (compiler). Class or object hierarchies must be carefully designed, considering possible incorrect uses that cannot be detected syntactically. This issue is known as the [[Liskov substitution principle]].
 
===Gang of Four design patterns===
{{Main|Design pattern (computer science)}}
''[[Design Patterns (book)|Design Patterns: Elements of Reusable Object-Oriented Software]]'' is an influential book published in 1994 by [[Erich Gamma]], [[Richard Helm]], [[Ralph Johnson (computer scientist)|Ralph Johnson]], and [[John Vlissides]], often referred to humorously as the "Gang of Four". Along with exploring the capabilities and pitfalls of object-oriented programming, it describes 23 common programming problems and patterns for solving them.
As of April 2007, the book was in its 36th printing.
 
''[[Design Patterns: Elements of Reusable Object-Oriented Software]]'' is a famous book published in 1994 by four authors: [[Erich Gamma]], [[Richard Helm]], [[Ralph Johnson (computer scientist)|Ralph Johnson]], and [[John Vlissides]]. People often call them the "Gang of Four". The book talks about the strengths and weaknesses of OOP and explains 23 common ways to solve programming problems.
The book describes the following patterns:
 
These solutions, called "design patterns," are grouped into three types:
 
* ''[[Creational pattern]]s'' (5): [[Factory method pattern]], [[Abstract factory pattern]], [[Singleton pattern]], [[Builder pattern]], [[Prototype pattern]]
* ''[[Structural pattern]]s'' (7): [[Adapter pattern]], [[Bridge pattern]], [[Composite pattern]], [[Decorator pattern]], [[Facade pattern]], [[Flyweight pattern]], [[Proxy pattern]]
Line 244 ⟶ 229:
===Object-orientation and databases===
{{Main|Object-relational impedance mismatch|Object-relational mapping|Object database}}
Both object-oriented programming and [[relational database management systems]] (RDBMSs) are extremely common in software {{As of|2006|alt=today}}. Since [[relational database]]s don't store objects directly (though some RDBMSs have object-oriented features to approximate this), there is a general need to bridge the two worlds. The problem of bridging object-oriented programming accesses and data patterns with relational databases is known as [[object-relational impedance mismatch]]. There are a number of approaches to cope with this problem, but no general solution without downsides.<ref name="RDMDBobjectmis">{{Cite web| first = Ted| last = Neward| title = The Vietnam of Computer Science| date = 26 June 2006| access-date = 2 June 2010| publisher = Interoperability Happens| url = http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx| archive-url = https://web.archive.org/web/20060704030226/http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx| archive-date = 4 July 2006| url-status = dead| df = dmy-all}}</ref> One of the most common approaches is [[object-relational mapping]], as found in [[Integrated development environment|IDE]] languages such as [[Visual FoxPro]] and libraries such as [[Java Data Objects]] and [[Ruby on Rails]]' ActiveRecord.
 
Both OOP and [[relational database management systems]] (RDBMSs) are widely used in software today. However, [[relational database]]s don't store objects directly, which creates a challenge when using them together. This issue is called [[object-relational impedance mismatch]].
There are also [[object database]]s that can be used to replace RDBMSs, but these have not been as technically and commercially successful as RDBMSs.
 
To solve this problem, developers use different methods, but none of them are perfect.<ref name="RDMDBobjectmis">{{Cite web |last1=Neward |first1=Ted |date=26 June 2006 |title=The Vietnam of Computer Science |access-date=2 June 2010 |publisher=Interoperability Happens |url=http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx |archive-url=https://web.archive.org/web/20060704030226/http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx |archive-date=4 July 2006 |url-status=dead |df=dmy-all}}</ref> One of the most common solutions is [[object-relational mapping]] (ORM), which helps connect object-oriented programs to relational databases. Examples of ORM tools include [[Visual FoxPro]], [[Java Data Objects]], and [[Ruby on Rails]] ActiveRecord.
===Real-world modeling and relationships===
OOP can be used to associate real-world objects and processes with digital counterparts. However, not everyone agrees that OOP facilitates direct real-world mapping (see [[object-oriented programming#Criticism|Criticism]] section) or that real-world mapping is even a worthy goal; [[Bertrand Meyer]] argues in ''[[Object-Oriented Software Construction]]''<ref name="Meyer230">Meyer, Second Edition, p. 230</ref> that a program is not a model of the world but a model of some part of the world; "Reality is a cousin twice removed". At the same time, some principal limitations of OOP have been noted.<ref>M.Trofimov, ''OOOP – The Third "O" Solution: Open OOP.'' First Class, [[Object Management Group|OMG]], 1993, Vol. 3, issue 3, p.14.</ref>
For example, the [[circle-ellipse problem]] is difficult to handle using OOP's concept of [[inheritance (object-oriented programming)|inheritance]].
 
Some databases, called [[object database]]s, are designed to work with OOP. However, they have not been as popular or successful as relational databases.
However, [[Niklaus Wirth]] (who popularized the adage now known as [[Wirth's law]]: "Software is getting slower more rapidly than hardware becomes faster") said of OOP in his paper, "Good Ideas through the Looking Glass", "This paradigm closely reflects the structure of systems 'in the real world', and it is therefore well suited to model complex systems with complex behaviours"<ref>{{cite journal |title=Good Ideas, Through the Looking Glass |journal=[[Computer (magazine)|Computer]] |year=2006 |last=Wirth |first=Nicklaus |author-link=Niklaus Wirth |volume=39 |issue=1 |pages=28–39 |url=https://pdfs.semanticscholar.org/10bd/dc49b85196aaa6715dd46843d9dcffa38358.pdf |archive-url=https://web.archive.org/web/20161012215755/https://pdfs.semanticscholar.org/10bd/dc49b85196aaa6715dd46843d9dcffa38358.pdf |url-status=dead |archive-date=12 October 2016 |access-date=2 October 2016 |doi=10.1109/mc.2006.20|s2cid=6582369 }}</ref> (contrast [[KISS principle]]).
 
Date and Darwen have proposed a theoretical foundation that uses OOP as a kind of customizable [[data type|type system]] to support RDBMSs, but it forbids objects containing pointers to other objects.<ref name="ThirdManifesto">C. J. Date, Hugh Darwen. ''Foundation for Future Database Systems: The Third Manifesto'' (2nd Edition)</ref>
[[Steve Yegge]] and others noted that natural languages lack the OOP approach of strictly prioritizing ''things'' (objects/[[noun]]s) before ''actions'' (methods/[[verb]]s).<ref name="executioniKoN">{{Cite web| first = Steve| last=Yegge |title = Execution in the Kingdom of Nouns| date=30 March 2006|access-date=3 July 2010| publisher = steve-yegge.blogspot.com| url=http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html}}</ref> This problem may cause OOP to suffer more convoluted solutions than procedural programming.<ref name="executioniKoN2">{{Cite web| first = Timothy| last= Boronczyk |title = What's Wrong with OOP| date=11 June 2009|access-date=3 July 2010| publisher = zaemis.blogspot.com| url=http://zaemis.blogspot.com/2009/06/whats-wrong-with-oop.html}}</ref>
 
===OOP and control flow===
OOP was developed to increase the [[code reuse|reusability]] and [[software maintenance|maintainability]] of source code.<ref name="realisticcodereuse">{{Cite web| first = Scott| last= Ambler| title = A Realistic Look at Object-Oriented Reuse| date=1 January 1998| access-date=4 July 2010| publisher = drdobbs.com| url=http://www.drdobbs.com/184415594}}</ref> Transparent representation of the [[control flow]] had no priority and was meant to be handled by a compiler. With the increasing relevance of parallel hardware and [[thread (computer science)|multithreaded coding]], developing transparent control flow becomes more important, something hard to achieve with OOP.<ref name="flaws">{{Cite web| first = Asaf| last= Shelly |title = Flaws of Object Oriented Modeling| date=22 August 2008|access-date=4 July 2010| publisher = Intel Software Network| url=http://software.intel.com/en-us/blogs/2008/08/22/flaws-of-object-oriented-modeling/}}</ref><ref name="multithreadingisaverb">{{Cite web| first = Justin| last = James| title = Multithreading is a verb not a noun| date = 1 October 2007| access-date = 4 July 2010| publisher = techrepublic.com| url = http://blogs.techrepublic.com.com/programming-and-development/?p=518| archive-url = https://web.archive.org/web/20071010105117/http://blogs.techrepublic.com.com/programming-and-development/?p=518| archive-date = 10 October 2007| url-status = dead| df = dmy-all}}</ref><ref name="multicore">{{Cite web| first = Asaf| last= Shelly| title = HOW TO: Multicore Programming (Multiprocessing) Visual C++ Class Design Guidelines, Member Functions| date=22 August 2008| access-date=4 July 2010| publisher = support.microsoft.com| url=http://support.microsoft.com/?scid=kb%3Ben-us%3B558117}}</ref><ref>{{cite web|url=http://existentialtype.wordpress.com/2011/04/17/some-advice-on-teaching-fp/|title=Some thoughts on teaching FP|author=Robert Harper |publisher=Existential Type Blog|access-date=5 December 2011|date=17 April 2011|author-link=Robert Harper (computer scientist)}}</ref>
 
===Responsibility- vs. data-driven design===
In [[Responsibilityresponsibility-driven design]] defines, classes inare termsbuilt ofaround awhat contract,they thatneed is,to ado classand shouldthe beinformation definedthey aroundshare, a responsibility andin the informationform thatof ita sharescontract. This is contrasteddifferent by Wirfs-Brock and Wilkerson withfrom [[Data-driven programming|data-driven design]], where classes are definedbuilt aroundbased on the data-structures thatthey mustneed beto heldstore. TheAccording authorsto holdWirfs-Brock thatand Wilkerson, the originators of responsibility-driven design, responsibility-driven design is preferablethe better approach.<ref name="Wirfs-Brock1989">{{cite journal|last1=Wirfs-Brock|first1=Rebecca|last2=Wilkerson|first2=Brian|title=Object-Oriented Design: A Responsibility-Driven Approach|journal=ACM SIGPLAN Notices|date=1989|volume=24|issue=10|page=74|doi=10.1145/74878.74885|doi-access=free}}</ref>
 
===SOLID and GRASP guidelines===
[[SOLID]] is a set of five rules for designing good software, created by Michael Feathers:
[[SOLID (object-oriented design)|SOLID]] is a mnemonic invented by Michael Feathers which spells out five software engineering design principles:
* [[Single responsibility principle]]
* [[Open/closed principle]]
* [[Liskov substitution principle]]
* [[Interface segregation principle]]
* [[Dependency inversion principle]]
 
* [[Single responsibility principle]]: A class should have only one reason to change.
[[GRASP (object-oriented design)|GRASP]] (General Responsibility Assignment Software Patterns) is another set of guidelines advocated by [[Craig Larman]].
* [[Open/closed principle]]: Software entities should be open for extension, but closed for modification.
* [[Liskov substitution principle]]: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.
* [[Interface segregation principle]]: Clients should not be forced to depend upon interfaces that they do not use.
* [[Dependency inversion principle]]: Depend upon abstractions, not concretes.
 
[[GRASP (object-oriented design)|GRASP]] (General Responsibility Assignment Software Patterns) is another set of software design rules, created by [[Craig Larman]], that helps developers assign responsibilities to different parts of a program:<ref>{{Cite web |last1=Karsh |first1=Patrick |date=Jul 19, 2023 |title=GRASP Principles: Object-Oriented Design Patterns |url=https://patrickkarsh.medium.com/object-oriented-design-with-grasp-principles-8049fa63e52 |access-date=Mar 30, 2025 |website=Medium}}</ref>
==Criticism==
The OOP paradigm has been criticised for a number of reasons, including not meeting its stated goals of reusability and modularity,<ref name="badprop"/><ref name="armstrongjoe"/> and for overemphasizing one aspect of software design and modeling (data/objects) at the expense of other important aspects (computation/algorithms).<ref name="stepanov"/><ref name="hickey"/>
 
* Creator Principle: allows classes create objects they closely use.
[[Luca Cardelli]] has claimed that OOP code is "intrinsically less efficient" than procedural code, that OOP can take longer to compile, and that OOP languages have "extremely poor modularity properties with respect to class extension and modification", and tend to be extremely complex.<ref name="badprop">{{Cite journal| first=Luca| last=Cardelli|title=Bad Engineering Properties of Object-Oriented Languages |url=http://lucacardelli.name/Papers/BadPropertiesOfOO.html| year=1996| access-date=21 April 2010| doi=10.1145/242224.242415| journal = ACM Comput. Surv.| volume=28| issn = 0360-0300| pages = 150–es| author-link=Luca Cardelli| issue=4es| s2cid=12105785}}</ref> The latter point is reiterated by [[Joe Armstrong (programming)|Joe Armstrong]], the principal inventor of [[Erlang (programming language)|Erlang]], who is quoted as saying:<ref name="armstrongjoe">Armstrong, Joe. In ''Coders at Work: Reflections on the Craft of Programming.'' Peter Seibel, ed. [http://www.codersatwork.com/ Codersatwork.com] {{Webarchive|url=https://web.archive.org/web/20100305165150/http://www.codersatwork.com/ |date=5 March 2010 }}, Accessed 13 November 2009.</ref>
* Information Expert Principle: assigns tasks to classes with the needed information.
* Low Coupling Principle: reduces class dependencies to improve flexibility and maintainability.
* High Cohesion Principle: designing classes with a single, focused responsibility.
* Controller Principle: assigns system operations to separate classes that manage flow and interactions.
* Polymorphism: allows different classes to be used through a common interface, promoting flexibility and reuse.
* Pure Fabrication Principle: create helper classes to improve design, boost cohesion, and reduce coupling.
 
==Formal semantics==
{{quote|The problem with object-oriented languages is they've got all this implicit environment that they carry around with them. You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.}}
Researchers have tried to formally define the [[Semantics (computer science)|semantics]] of OOP. [[Inheritance (object-oriented programming)|Inheritance]] presents difficulties, particularly with the interactions between open recursion and encapsulated state. Researchers have used [[recursive type]]s and [[F-Coalgebra|co-algebraic data types]] to incorporate essential features of OOP.<ref name=poll97>{{cite web|last1=Poll|first1=Erik|title=Subtyping and Inheritance for Categorical Datatypes|url=https://www.cs.ru.nl/E.Poll/papers/kyoto97.pdf|access-date=5 June 2011}}</ref> Abadi and Cardelli defined several extensions of [[System F-sub|System F<sub><:</sub>]] that deal with mutable objects, allowing both [[subtype polymorphism]] and [[parametric polymorphism]] (generics), and were able to formally model many OOP concepts and constructs.<ref name="AbadiCardelli">{{Cite book |first1=Martin |last1=Abadi |title=A Theory of Objects |url=http://portal.acm.org/citation.cfm?id=547964&dl=ACM&coll=portal |year=1996 |access-date=21 April 2010 |isbn=978-0-387-94775-4 |publisher=Springer-Verlag New York, Inc. |author-link=Martin Abadi|author2=Cardelli, Luca}}</ref> Although far from trivial, static analysis of object-oriented programming languages such as Java is a mature field,<ref>{{cite conference |last1=Tan |first1=Tian |last2=Li |first2=Yue |date=12 July 2023 |title=Tai-e: A Developer-Friendly Static Analysis Framework for Java by Harnessing the Good Designs of Classics|conference=ISSTA 2023 |pages=1093–1105 |doi=10.1145/3597926.3598120}}</ref> with several commercial tools.<ref>{{cite journal |last1=Bhutani |first1=Vikram |last2=Toosi |first2=Farshad Ghassemi |last3=Buckley |first3=Jim |date=1 June 2024 |title=Analysing the Analysers: An Investigation of Source Code Analysis Tools |journal=Applied Computer Systems |volume=29 |issue=1 |pages=98–111 |doi=10.2478/acss-2024-0013}}</ref>
 
=={{anchor|Criticism}}Criticism==
A study by Potok et al. has shown no significant difference in productivity between OOP and procedural approaches.<ref>{{Cite journal| url=http://www.csm.ornl.gov/~v8q/Homepage/Papers%20Old/spetep-%20printable.pdf| title=Productivity Analysis of Object-Oriented Software Developed in a Commercial Environment| last=Potok| first=Thomas|author2=Mladen Vouk |author3=Andy Rindos |journal=Software: Practice and Experience | volume=29|issue=10|pages=833–847 |year=1999 |access-date=21 April 2010| doi=10.1002/(SICI)1097-024X(199908)29:10<833::AID-SPE258>3.0.CO;2-P| s2cid=57865731}}</ref>
Some believe that OOP places too much focus on using objects rather than on [[algorithm]]s and [[data structure]]s.<ref name="stepanov"/><ref name="hickey"/> For example, programmer [[Rob Pike]] pointed out that OOP can make programmers think more about type hierarchy than composition.<ref name="RobPike">{{cite web |url=https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html |title=Less is exponentially more |last1=Pike |first1=Rob |date=25 June 2012 |access-date=1 October 2016}}</ref> He has called OOP "the [[Roman numerals]] of computing".<ref>{{cite mailing list |last1=Pike |first1=Rob |author1-link=Rob Pike |date=2 March 2004 |url=http://groups.google.com/group/comp.os.plan9/msg/006fec195aeeff15 |title=[9fans] Re: Threads: Sewing badges of honor onto a Kernel |access-date=17 November 2016 |mailing-list=comp.os.plan9}}</ref> [[Rich Hickey]], creator of [[Clojure]], described OOP as overly simplistic, especially when it comes to representing real-world things that change over time.<ref name="hickey">{{cite conference |last1=Hickey |first1=Rich |date=November 2009 |url=http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey |title=Are We There Yet? (keynote) |conference=JVM Languages Summit}}</ref> [[Alexander Stepanov]] said that OOP tries to fit everything into a single type, which can be limiting. He argued that sometimes we need multisorted algebras: families of interfaces that span multiple types, such as in [[generic programming]]. Stepanov also said that calling everything an "object" doesn't add much understanding.<ref name="stepanov">{{Cite web |last1=Stepanov |first1=Alexander |author1-link=Alexander Stepanov |year=2001–2008 |url=http://www.stlport.org/resources/StepanovUSA.html |title=STLport: An Interview with A. Stepanov |access-date=21 April 2010}}</ref>
 
OOP was created to make code easier to [[code reuse|reuse]] and [[software maintenance|maintain]].<ref name="realisticcodereuse">{{Cite web |last1=Ambler |first1=Scott |date=1 January 1998 |title=A Realistic Look at Object-Oriented Reuse |access-date=5 August 2025 |publisher=drdobbs.com |url=http://www.drdobbs.com/184415594}}</ref> However, it was not designed to clearly show the flow of a program's instructions. That was left to the compiler. As computers began using more parallel processing and multiple [[thread (computer science)|threads]], it became more important to understand and control how instructions flow. This is difficult to do with OOP.<ref name="flaws">{{Cite web |first1=Asaf |last1=Shelly |title=Flaws of Object Oriented Modeling |date=22 August 2008|access-date=4 July 2010 |publisher=Intel Software Network |url=http://software.intel.com/en-us/blogs/2008/08/22/flaws-of-object-oriented-modeling/}}</ref><ref name="multithreadingisaverb">{{Cite web |first1=Justin |last1=James |title=Multithreading is a verb not a noun |date=1 October 2007 |access-date=4 July 2010 |publisher=techrepublic.com |url=http://blogs.techrepublic.com.com/programming-and-development/?p=518 |archive-url=https://web.archive.org/web/20071010105117/http://blogs.techrepublic.com.com/programming-and-development/?p=518 |archive-date=10 October 2007 |url-status=dead |df=dmy-all}}</ref><ref name="multicore">{{Cite web |first1=Asaf |last1=Shelly |title=HOW TO: Multicore Programming (Multiprocessing) Visual C++ Class Design Guidelines, Member Functions |date=22 August 2008 |access-date=4 July 2010 |publisher=support.microsoft.com |url=http://support.microsoft.com/?scid=kb%3Ben-us%3B558117}}</ref><ref>{{cite web|url=http://existentialtype.wordpress.com/2011/04/17/some-advice-on-teaching-fp/|title=Some thoughts on teaching FP|author=Robert Harper |publisher=Existential Type Blog|access-date=5 December 2011|date=17 April 2011|author-link=Robert Harper (computer scientist)}}</ref>
[[Christopher J. Date]] stated that critical comparison of OOP to other technologies, relational in particular, is difficult because of lack of an agreed-upon and rigorous definition of OOP;<ref name="DatePage650">C. J. Date, Introduction to Database Systems, 6th-ed., Page 650</ref> however, Date and Darwen have proposed a theoretical foundation on OOP that uses OOP as a kind of customizable [[data type|type system]] to support [[RDBMS]].<ref name="ThirdManifesto">C. J. Date, Hugh Darwen. ''Foundation for Future Database Systems: The Third Manifesto'' (2nd Edition)</ref>
 
Many popular programming languages, like C++, Java, and Python, use OOP. In the past, OOP was widely accepted,<ref>{{cite book |last1=Brucker |first1=Achim D. |last2=Wolff |first2=Burkhart |title=ECOOP 2008 – Object-Oriented Programming |chapter=Extensible Universes for Object-Oriented Data Models |series=Lecture Notes in Computer Science |date=2008 |volume=5142 |pages=438–462 |doi=10.1007/978-3-540-70592-5_19|isbn=978-3-540-70591-8 |quote=object-oriented programming is a widely accepted programming paradigm}}</ref> but recently, some programmers have criticized it and prefer functional programming instead.<ref>{{cite news |last1=Cassel |first1=David |title=Why Are So Many Developers Hating on Object-Oriented Programming? |url=https://thenewstack.io/why-are-so-many-developers-hating-on-object-oriented-programming/ |work=The New Stack |date=21 August 2019}}</ref> A study by Potok et al. found no major difference in productivity between OOP and other methods.<ref>{{Cite journal |url=http://www.csm.ornl.gov/~v8q/Homepage/Papers%20Old/spetep-%20printable.pdf |title=Productivity Analysis of Object-Oriented Software Developed in a Commercial Environment |last1=Potok |first1=Thomas |last2=Vouk |first2=Mladen |last3=Rindos |first3=Andy |journal=Software: Practice and Experience |volume=29|issue=10|pages=833–847 |year=1999 |access-date=21 April 2010 |doi=10.1002/(SICI)1097-024X(199908)29:10<833::AID-SPE258>3.0.CO;2-P |s2cid=57865731}}</ref>
In an article Lawrence Krubner claimed that compared to other languages (LISP dialects, functional languages, etc.) OOP languages have no unique strengths, and inflict a heavy burden of unneeded complexity.<ref name="lawrence">{{Cite web| last=Krubner| first=Lawrence| title=Object Oriented Programming is an expensive disaster which must end| url=http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end| publisher=smashcompany.com| access-date=14 October 2014| archive-url=https://web.archive.org/web/20141014233854/http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end| archive-date=14 October 2014| url-status=dead}}</ref>
 
[[Paul Graham (computer programmer)|Paul Graham]], a well-known computer scientist, believes big companies like OOP because it helps manage large teams of average programmers. He argues that OOP adds structure, making it harder for one person to make serious mistakes, but at the same time restrains smart programmers.<ref name="graham">{{Cite web |last1=Graham |first1=Paul |title=Why ARC isn't especially Object-Oriented. |url=http://www.paulgraham.com/noop.html |publisher=PaulGraham.com |access-date=13 November 2009 |author-link=Paul Graham (computer programmer)}}</ref> [[Eric S. Raymond]], a [[Unix]] programmer and [[open-source software]] advocate, argues that OOP is not the best way to write programs.<ref name="Eric S. Raymond 2003"/>
[[Alexander Stepanov]] compares object orientation unfavourably to [[generic programming]]:<ref name="stepanov">{{Cite web| url=http://www.stlport.org/resources/StepanovUSA.html| title=STLport: An Interview with A. Stepanov| last=Stepanov| first=Alexander| access-date=21 April 2010| author-link=Alexander Stepanov}}</ref>
 
Richard Feldman says that, while OOP features helped some languages stay organized, their popularity comes from other reasons.<ref>{{cite web |last1=Feldman |first1=Richard |title=Why Isn't Functional Programming the Norm? |website=[[YouTube]] |date=30 September 2019 |url=https://www.youtube.com/watch?v=QyJZzq0v7Z4&t=2069s |language=en}}</ref> Lawrence Krubner argues that OOP doesn't offer special advantages compared to other styles, like functional programming, and can complicate coding.<ref name="lawrence">{{Cite web |last1=Krubner |first1=Lawrence |title=Object Oriented Programming is an expensive disaster which must end |url=http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end |publisher=smashcompany.com |access-date=14 October 2014 |archive-url=https://web.archive.org/web/20141014233854/http://www.smashcompany.com/technology/object-oriented-programming-is-an-expensive-disaster-which-must-end |archive-date=14 October 2014 |url-status=dead}}</ref> [[Luca Cardelli]] says that OOP is slower and takes longer to compile than procedural programming.<ref name="badprop">{{Cite journal |first1=Luca |last1=Cardelli|title=Bad Engineering Properties of Object-Oriented Languages |url=http://lucacardelli.name/Papers/BadPropertiesOfOO.html |year=1996 |access-date=21 April 2010 |doi=10.1145/242224.242415 |journal=ACM Comput. Surv. |volume=28 |issn=0360-0300 |pages=150–es |author-link=Luca Cardelli |issue=4es |s2cid=12105785 |url-access=subscription}}</ref>
{{quote|I find OOP technically unsound. It attempts to decompose the world in terms of interfaces that vary on a single type. To deal with the real problems you need multisorted algebras&nbsp;— families of interfaces that span multiple types. I find OOP philosophically unsound. It claims that everything is an object. Even if it is true it is not very interesting&nbsp;— saying that everything is an object is saying nothing at all.}}
 
[[Paul Graham (computer programmer)|Paul Graham]] has suggested that OOP's popularity within large companies is due to "large (and frequently changing) groups of mediocre programmers". According to Graham, the discipline imposed by OOP prevents any one programmer from "doing too much damage".<ref name="graham">{{Cite web| last=Graham| first=Paul| title=Why ARC isn't especially Object-Oriented.| url=http://www.paulgraham.com/noop.html| publisher=PaulGraham.com| access-date=13 November 2009| author-link=Paul Graham (computer programmer)}}</ref>
 
Leo Brodie has suggested a connection between the standalone nature of objects and a tendency to [[duplicate code]]<ref>{{Cite book| url=http://thinking-forth.sourceforge.net/thinking-forth-ans.pdf| title=Thinking Forth| last=Brodie| first=Leo|pages=92–93 |year=1984 |access-date=4 May 2018}}</ref> in violation of the [[don't repeat yourself]] principle<ref>{{cite web| work=Category Extreme Programming| last=Hunt| first=Andrew| url=http://wiki.c2.com/?DontRepeatYourself|title=Don't Repeat Yourself| access-date=4 May 2018}}</ref> of software development.
 
[[Steve Yegge]] noted that, as opposed to [[functional programming]]:<ref name="yegge">{{Cite web|url=http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html|title=Stevey's Blog Rants: Execution in the Kingdom of Nouns|access-date=20 May 2020}}</ref>
 
{{quote|Object Oriented Programming puts the Nouns first and foremost. Why would you go to such lengths to put one part of speech on a pedestal? Why should one kind of concept take precedence over another? It's not as if OOP has suddenly made verbs less important in the way we actually think. It's a strangely skewed perspective.}}
 
[[Rich Hickey]], creator of [[Clojure]], described object systems as overly simplistic models of the real world. He emphasized the inability of OOP to model time properly, which is getting increasingly problematic as software systems become more concurrent.<ref name="hickey">Rich Hickey, JVM Languages Summit 2009 keynote, [http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey Are We There Yet?] November 2009.</ref>
 
[[Eric S. Raymond]], a [[Unix]] programmer and [[open-source software]] advocate, has been critical of claims that present object-oriented programming as the "One True Solution", and has written that object-oriented programming languages tend to encourage thickly layered programs that destroy transparency.<ref name="Eric S. Raymond 2003">{{cite web|url=http://www.catb.org/esr/writings/taoup/html/unix_and_oo.html|title=The Art of Unix Programming: Unix and Object-Oriented Languages|author=Eric S. Raymond|date=2003|access-date=6 August 2014}}</ref> Raymond compares this unfavourably to the approach taken with Unix and the [[C (programming language)|C programming language]].<ref name="Eric S. Raymond 2003"/>
 
[[Rob Pike]], a programmer involved in the creation of [[UTF-8]] and [[Go (programming language)|Go]], has called object-oriented programming "the [[Roman numerals]] of computing"<ref>{{cite mailing list |url=http://groups.google.com/group/comp.os.plan9/msg/006fec195aeeff15 |title=[9fans] Re: Threads: Sewing badges of honor onto a Kernel |date=2 March 2004 |access-date=17 November 2016 |mailing-list=comp.os.plan9 |last=Pike |first=Rob |author-link=Rob Pike}}</ref> and has said that OOP languages frequently shift the focus from [[data structure]]s and [[algorithm]]s to [[data type|types]].<ref>{{cite web |url=https://commandcenter.blogspot.com/2012/06/less-is-exponentially-more.html |title=Less is exponentially more |last1=Pike |first1=Rob |date=25 June 2012 |access-date=1 October 2016 }}</ref> Furthermore, he cites an instance of a [[Java (programming language)|Java]] professor whose "idiomatic" solution to a problem was to create six new classes, rather than to simply use a [[lookup table]].<ref>{{cite web |url=http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |title=A few years ago I saw this page |last1=Pike |first1=Rob |access-date=1 October 2016 |date=14 November 2012|archive-url=https://web.archive.org/web/20180814173134/http://plus.google.com/+RobPikeTheHuman/posts/hoJdanihKwb |archive-date=14 August 2018 }}</ref>
 
Regarding inheritance, [[Robert C. Martin|Bob Martin]] states that because they are software, related classes do not necessarily share the relationships of the things they represent.<ref>{{cite web | url=https://www.youtube.com/watch?v=zHiWqnTWsn4 | title=Uncle Bob SOLID principles | website=[[YouTube]] }}</ref>
 
==Formal semantics==
{{see also|Formal semantics of programming languages}}
Objects are the run-time entities in an object-oriented system. They may represent a person, a place, a bank account, a table of data, or any item that the program has to handle.
 
There have been several attempts at formalizing the concepts used in object-oriented programming. The following concepts and constructs have been used as interpretations of OOP concepts:
* [[F-Coalgebra|co algebraic data types]]<ref name=poll97>{{cite web|last=Poll|first=Erik|title=Subtyping and Inheritance for Categorical Datatypes|url=https://www.cs.ru.nl/E.Poll/papers/kyoto97.pdf|access-date=5 June 2011}}</ref>
* [[recursive type]]s
* encapsulated state
* [[Inheritance (object-oriented programming)|inheritance]]
* [[Record (computer science)|records]] are basis for understanding objects if [[function literal]]s can be stored in fields (like in functional-programming languages), but the actual calculi need be considerably more complex to incorporate essential features of OOP. Several extensions of [[System F-sub|System F<sub><:</sub>]] that deal with mutable objects have been studied;<ref name="AbadiCardelli"/> these allow both [[subtype polymorphism]] and [[parametric polymorphism]] (generics)
 
Attempts to find a consensus definition or theory behind objects have not proven very successful (however, see Abadi & Cardelli, [http://portal.acm.org/citation.cfm?id=547964&dl=ACM&coll=portal ''A Theory of Objects'']<ref name="AbadiCardelli">{{Cite book| first=Martin| last=Abadi |title=A Theory of Objects| url=http://portal.acm.org/citation.cfm?id=547964&dl=ACM&coll=portal| year=1996| access-date=21 April 2010| isbn = 978-0-387-94775-4| publisher = Springer-Verlag New York, Inc.| author-link=Martin Abadi|author2=Cardelli, Luca }}</ref> for formal definitions of many OOP concepts and constructs), and often diverge widely. For example, some definitions focus on mental activities, and some on program structuring. One of the simpler definitions is that OOP is the act of using "map" data structures or arrays that can contain functions and pointers to other maps, all with some [[syntactic sugar|syntactic and scoping sugar]] on top. Inheritance can be performed by cloning the maps (sometimes called "prototyping").
 
==See also==
{{Portal|Computer programming}}
* [[CADES]]
* [[Common Object Request Broker Architecture]] (CORBA)
* [[Comparison of programming languages (object-oriented programming)]]
* [[Comparison of programming paradigms]]
* [[Component-based software engineering]]
* [[Distributed Component Object Model]]
* [[Design by contract]]
* [[Interface description language]]
* [[IDEF4]]
* [[Jeroo]]
* [[List of object-oriented programming languages]]
* [[Object association]]
* [[Object database]]
* [[Object model reference]]
* [[Object modeling language]]
* [[Object-oriented analysis and design]]
* [[Object-relationaloriented impedance mismatchmodeling]] (and The Third Manifesto)
* [[Object-relationaloriented mappingontology]]
* [[UML]]
 
===Systems===
* [[CADES]]
* [[Common Object Request Broker Architecture]] (CORBA)
* [[Distributed Component Object Model]]
* [[Distributed Data Management Architecture]]
* [[Jeroo]]
 
===Modeling languages===
* [[IDEF4]]
* [[Interface description language]]
* [[Lepus3]]
* [[Unified Modeling Language|UML]]
 
==References==
Line 350 ⟶ 296:
==Further reading==
* {{Cite book
|firstfirst1=Martin
|lastlast1=Abadi
|author-link=Martin Abadi
|author2=Luca Cardelli
Line 361 ⟶ 307:
}}
* {{Cite book
|firstfirst1=Harold
|lastlast1=Abelson
|author-link=Harold Abelson
|author2=Gerald Jay Sussman
Line 377 ⟶ 323:
}}
* {{Cite journal
|first first1= Deborah J.
|last last1= Armstrong
|date=February 2006
|title = The Quarks of Object-Oriented Development
|journal = Communications of the ACM
|volume = 49
|issue = 2
|pages = 123–128
|issn = 0001-0782
|doi = 10.1145/1113034.1113040
|s2cid = 11485502
}}
*{{cite book
|title="Effective Java: Programming Language Guide"
|last1=Bloch
|first1=Joshua
|publisher=Addison-Wesley
|edition=third
|isbn=978-0134685991
|year=2018
}}
* {{Cite book
|last1=Booch
|first=Grady
|first1=Grady
|last=Booch
|authorauthor1-link=Grady Booch
|year=1997
|title=Object-Oriented Analysis and Design with Applications
Line 400 ⟶ 355:
}}
* {{Cite book
|firstfirst1=Peter
|lastlast1=Eeles
|author2=Oliver Sims
|year=1998
Line 411 ⟶ 366:
}}
* {{Cite book
|firstfirst1=Erich
|lastlast1=Gamma
|author-link=Erich Gamma
|author2=Richard Helm
Line 428 ⟶ 383:
}}
* {{Cite book
|firstfirst1=Paul
|lastlast1=Harmon
|author-link=Paul Harmon (management author)
|author2=William Morrissey
Line 439 ⟶ 394:
}}
* {{Cite book
|firstfirst1=Ivar
|lastlast1=Jacobson
|author-link=Ivar Jacobson
|year=1992
Line 450 ⟶ 405:
}}
* {{Cite book
|first first1= Alan
|last last1= Kay
|author-link = Alan Kay
|title = The Early History of Smalltalk
|url = http://gagne.homedns.org/%7etgagne/contrib/EarlyHistoryST.html
|access-date = 18 April 2005
|archive-url = https://web.archive.org/web/20050404075821/http://gagne.homedns.org/~tgagne/contrib/EarlyHistoryST.html
|archive-date = 4 April 2005
|url-status = dead
|df = dmy-all
}}
* {{Cite book
|firstfirst1=Bertrand
|lastlast1=Meyer
|author-link=Bertrand Meyer
|year=1997
Line 469 ⟶ 424:
|publisher=[[Prentice Hall]]
|isbn=978-0-13-629155-8
|url=https://bertrandmeyer.com/OOSC2/
|title-link=Object-Oriented Software Construction
}}
* {{Cite book
|firstfirst1=Rudolf
|lastlast1=Pecinovsky
|year=2013
|title=OOP – Learn Object Oriented Thinking & Programming
Line 481 ⟶ 436:
}}
* {{Cite book
|last1=Rumbaugh
|first=James
|first1=James
|last=Rumbaugh
|authorauthor1-link=James Rumbaugh
|last2=Blaha |first2=Michael
|author2=Michael Blaha
|author3last3=William Premerlani |first3=William
|last4=Eddy |first4=Frederick
|author4=Frederick Eddy
|author5last5=William Lorensen |first5=William
|year=1991
|title=Object-Oriented Modeling and Design
Line 495 ⟶ 450:
}}
* {{Cite book
|firstfirst1=Stephen
|lastlast1=Schach
|year=2006
|title=Object-Oriented and Classical Software Engineering, Seventh Edition
Line 503 ⟶ 458:
}}
* {{Cite book
|firstfirst1=Axel-Tobias
|lastlast1=Schreiner
|year=1993
|title=Object oriented programming with ANSI-C
Line 511 ⟶ 466:
|hdl=1850/8544}}
* {{Cite book
|firstfirst1=David A.
|lastlast1=Taylor
|year=1992
|title=Object-Oriented Information Systems – Planning and Implementation
Line 520 ⟶ 475:
}}
* {{Cite book
|firstfirst1=Matt
|lastlast1=Weisfeld
|year=2009
|title=The Object-Oriented Thought Process, Third Edition
Line 528 ⟶ 483:
}}
* {{Cite book
|firstfirst1=David
|lastlast1=West
|year=2004
|title=Object Thinking (Developer Reference)
Line 542 ⟶ 497:
* [http://www.codeproject.com/Articles/22769/Introduction-to-Object-Oriented-Programming-Concep Introduction to Object Oriented Programming Concepts (OOP) and More] by L.W.C. Nirosh
*[https://thenewstack.io/why-are-so-many-developers-hating-on-object-oriented-programming/ Discussion on Cons of OOP]
* [http://java.sun.com/docs/books/tutorial/java/concepts/index.html OOP Concepts (Java Tutorials)]
 
{{Programming paradigms navbox}}
{{Types of programming languages}}
{{Software engineering}}
 
{{Authority control}}
 
Line 551 ⟶ 507:
[[Category:Object-oriented programming| ]]
[[Category:Programming paradigms]]
<!-- Hidden categories below -->
[[Category:Norwegian inventions]]
[[Category:Articles with example code]]