Object-Oriented Programming (OOP) Pattern: Difference between revisions
(Created page with "An Object-Oriented Programming (OOP) Pattern is a programming pattern that follows an object-oriented design (of OOP objects composed of OOP Fields and O...") |
m (Text replacement - "]]↵----" to "]]. ----") |
||
(6 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
** It can be instantiated in an [[Object-Oriented Programming Language]] and implemented by a [[Object-Oriented Programming System]]. | ** It can be instantiated in an [[Object-Oriented Programming Language]] and implemented by a [[Object-Oriented Programming System]]. | ||
** It can involve [[programming technique]]s such as: [[Data Abstraction]], [[Program Encapsulation]], [[Message Passing]], [[OOP Polymorphism]], [[Modular Programming]] and/or [[Program Behavior Inheritance]]. | ** It can involve [[programming technique]]s such as: [[Data Abstraction]], [[Program Encapsulation]], [[Message Passing]], [[OOP Polymorphism]], [[Modular Programming]] and/or [[Program Behavior Inheritance]]. | ||
** … | |||
* <B>Counter-Example(s):</B> | * <B>Counter-Example(s):</B> | ||
** an [[Agent-Oriented Programming Paradigm]], | ** an [[Agent-Oriented Programming Paradigm]], | ||
Line 9: | Line 10: | ||
** a [[Functional Programming Paradigm]], | ** a [[Functional Programming Paradigm]], | ||
** a [[Data-Driven Programming Paradigm]]. | ** a [[Data-Driven Programming Paradigm]]. | ||
* <B>See</U>:</B> [[Computer Program Object]], [[Computer Programming Task]], [[Object-Oriented Program]], [[UML]] | * <B>See</U>:</B> [[Computer Program Object]], [[Computer Programming Task]], [[Object-Oriented Program]], [[UML]]. | ||
---- | ---- | ||
---- | ---- | ||
Line 17: | Line 19: | ||
=== 2020 === | === 2020 === | ||
* (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/Object-oriented_programming Retrieved:2020-5-6. | * (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/Object-oriented_programming Retrieved:2020-5-6. | ||
** '''Object-oriented programming''' ('''OOP''') is a [[programming paradigm]] based on the concept of | ** '''Object-oriented programming''' ('''OOP''') is a [[programming paradigm]] based on the concept of “[[Object (computer science)|objects]]", which can contain [[data]], in the form of [[Field (computer science)|fields]] (often known as ''attributes'' or ''properties''), and code, in the form of procedures (often known as ''[[Method (computer science)|methods]]''). A feature of objects is an object's procedures that can access and often modify the data fields of the object with which they are associated (objects have a notion of “[[this (computer programming)|this]]” or "self"). In OOP, computer programs are designed by making them out of objects that interact with one another. <ref> , 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]]. ... | ||
=== 2013 === | === 2013 === | ||
Line 28: | Line 30: | ||
*** [[Dynamic dispatch]] – when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an [[abstract data type]] (or module), which has a fixed (static) implementation of the operations for all instances. It is a programming methodology that gives modular component development while at the same time being very efficient. | *** [[Dynamic dispatch]] – when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an [[abstract data type]] (or module), which has a fixed (static) implementation of the operations for all instances. It is a programming methodology that gives modular component development while at the same time being very efficient. | ||
*** [[Encapsulation (object-oriented programming)|Encapsulation]] (or [[multi-methods]], in which case the state is kept separate) | *** [[Encapsulation (object-oriented programming)|Encapsulation]] (or [[multi-methods]], in which case the state is kept separate) | ||
*** [[Subtype polymorphism]] | *** [[Subtype polymorphism]]. | ||
*** Object [[inheritance (object-oriented programming)|inheritance]] (or [[Delegation_(programming)#As_a_language_feature|delegation]]) | *** Object [[inheritance (object-oriented programming)|inheritance]] (or [[Delegation_(programming)#As_a_language_feature|delegation]]) | ||
*** [[Open recursion]] – a special variable (syntactically it may be a keyword), usually called <code>this</code> or <code>self</code>, that allows a method body to invoke another method body of the same object. 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. | *** [[Open recursion]] – a special variable (syntactically it may be a keyword), usually called <code>this</code> or <code>self</code>, that allows a method body to invoke another method body of the same object. 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. | ||
Line 36: | Line 38: | ||
*** [[Instance (computer science)|Instance]]s of classes | *** [[Instance (computer science)|Instance]]s of classes | ||
*** [[Method (computer science)|Method]]s which act on the attached objects. | *** [[Method (computer science)|Method]]s which act on the attached objects. | ||
*** [[Message passing]] | *** [[Message passing]]. | ||
*** [[Abstraction (computer science)|Abstraction]] | *** [[Abstraction (computer science)|Abstraction]]. | ||
** … Decoupling refers to careful controls that separate code modules from particular use cases, which increases code re-usability. A common use of decoupling in OOP is to polymorphically decouple the encapsulation (see [[Bridge pattern]] and [[Adapter pattern]]) - for example, using a method interface which an encapsulated object must satisfy, as opposed to using the object's class. | ** … Decoupling refers to careful controls that separate code modules from particular use cases, which increases code re-usability. A common use of decoupling in OOP is to polymorphically decouple the encapsulation (see [[Bridge pattern]] and [[Adapter pattern]]) - for example, using a method interface which an encapsulated object must satisfy, as opposed to using the object's class. | ||
<references/> | <references/> |
Latest revision as of 05:20, 28 November 2023
An Object-Oriented Programming (OOP) Pattern is a programming pattern that follows an object-oriented design (of OOP objects composed of OOP Fields and OOP Methods).
- Context:
- It can be instantiated in an Object-Oriented Programming Language and implemented by a Object-Oriented Programming System.
- It can involve programming techniques such as: Data Abstraction, Program Encapsulation, Message Passing, OOP Polymorphism, Modular Programming and/or Program Behavior Inheritance.
- …
- Counter-Example(s):
- See: Computer Program Object, Computer Programming Task, Object-Oriented Program, UML.
References
2020
- (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/Object-oriented_programming Retrieved:2020-5-6.
- Object-oriented programming (OOP) is a programming paradigm based on the concept of “objects", which can contain data, in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). A feature of objects is an object's procedures that can access and often modify the data fields of the object with which they are associated (objects have a notion of “this” or "self"). In OOP, computer programs are designed by making them out of objects that interact with one another. [1] OOP languages are diverse, but the most popular ones are class-based, meaning that objects are instances of classes, which also determine their types. ...
2013
- (Chisnall, 2013) ⇒ David Chisnall. (2013). “The Challenge of Cross-language Interoperability.” In: Queue Journal, 11(10). doi:10.1145/2542661.2543971
- QUOTE: Object-oriented languages bind some notion of code and data together. Alan Kay, who helped develop object-oriented programming while at Xerox PARC, described objects as "simple computers that communicate via message passing." This definition leaves a lot of leeway for different languages to fill in the details:
2011
- http://en.wikipedia.org/wiki/Object-oriented_programming
- … As a result, a significantly different yet analogous terminology is used to define the concepts of object and instance. Benjamin C. Pierce and some other researchers view as futile any attempt to distill OOP to a minimal set of features. He nonetheless identifies fundamental features that support the OOP programming style in most object-oriented languages:
- Dynamic dispatch – when a method is invoked on an object, the object itself determines what code gets executed by looking up the method at run time in a table associated with the object. This feature distinguishes an object from an abstract data type (or module), which has a fixed (static) implementation of the operations for all instances. It is a programming methodology that gives modular component development while at the same time being very efficient.
- Encapsulation (or multi-methods, in which case the state is kept separate)
- Subtype polymorphism.
- Object inheritance (or delegation)
- Open recursion – a special variable (syntactically it may be a keyword), usually called
this
orself
, that allows a method body to invoke another method body of the same object. This variable is late-bound ; it allows a method defined in one class to invoke another method that is defined later, in some subclass thereof.
- Similarly, in his 2003 book, Concepts in programming languages, John C. Mitchell identifies four main features: dynamic dispatch, abstraction, subtype polymorphism, and inheritance.[2] Michael Lee Scott in Programming Language Pragmatics considers only encapsulation, inheritance and dynamic dispatch.[3]
- Additional concepts used in object-oriented programming include:
- Classes of objects
- Instances of classes
- Methods which act on the attached objects.
- Message passing.
- Abstraction.
- … Decoupling refers to careful controls that separate code modules from particular use cases, which increases code re-usability. A common use of decoupling in OOP is to polymorphically decouple the encapsulation (see Bridge pattern and Adapter pattern) - for example, using a method interface which an encapsulated object must satisfy, as opposed to using the object's class.
- … As a result, a significantly different yet analogous terminology is used to define the concepts of object and instance. Benjamin C. Pierce and some other researchers view as futile any attempt to distill OOP to a minimal set of features. He nonetheless identifies fundamental features that support the OOP programming style in most object-oriented languages:
- ↑ , section 1.6 "Object-Oriented Programming"
- ↑ John C. Mitchell, Concepts in programming languages, Cambridge University Press, 2003, ISBN 0-521-78098-5, p.278
- ↑ Michael Lee Scott, Programming language pragmatics, Edition 2, Morgan Kaufmann, 2006, ISBN 0-12-633951-1, p. 470 vikas