Object-oriented programming: Difference between revisions

Content deleted Content added
m Reverted edits by 2402:4000:21C3:58C4:E9AD:44E2:378:7503 (talk) (HG) (3.4.12)
No edit summary
Tags: Reverted possible vandalism Visual edit Mobile edit Mobile web edit
Line 200:
{{See also|List of object-oriented programming languages}}
 
[[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:
<!-- 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]], [[JavaScript]], [[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]]l 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.
 
===OOP in dynamic languages===
In recent years, object-oriented programming has become especially popular in [[dynamic programming language|dynamic programing 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 [[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]].
 
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 parameterssparameters. 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:
===OOP in a network protocol===
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:
* Fields defining the data values that form messages, such as their length, code point and data values.
* Objects and collections of objects similar to what would be found in a [[Smalltalk]] program for messages and parameters.
* 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.
* 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.
 
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==