Jump to content

Object-based language: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Simplified discussion of prototype-based languages
Undid revision 617294383 unsourced and erroneous edit.
Line 4: Line 4:
Examples of [[object-oriented programming language|object-oriented languages]] include [[Simula]], [[Smalltalk]], [[C++]] (whose object model was based on Simula's), [[Objective-C]] (whose object model was based on Smalltalk's), [[Eiffel (programming language)|Eiffel]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Java (programming language)|Java]], [[C Sharp (programming language)|C#]], and [[REALbasic]] (an object-oriented BASIC dialect). Examples of a language that is object-based but not object-oriented are early versions of [[Ada (programming language)|Ada]], [[Javascript]], and [[Visual Basic]] (VB). These languages all support the definition of an object as a data structure but lack polymorphism and inheritance.
Examples of [[object-oriented programming language|object-oriented languages]] include [[Simula]], [[Smalltalk]], [[C++]] (whose object model was based on Simula's), [[Objective-C]] (whose object model was based on Smalltalk's), [[Eiffel (programming language)|Eiffel]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Java (programming language)|Java]], [[C Sharp (programming language)|C#]], and [[REALbasic]] (an object-oriented BASIC dialect). Examples of a language that is object-based but not object-oriented are early versions of [[Ada (programming language)|Ada]], [[Javascript]], and [[Visual Basic]] (VB). These languages all support the definition of an object as a data structure but lack polymorphism and inheritance.


Sometimes, the term "object-based" is applied to [[prototype-based languages]]. But in practice, the term "object-based" is usually applied to those object-based languages that are not also object-oriented. Instead the terms "object-based" and "object-oriented" are normally used as mutually exclusive alternatives, rather than as categories that overlap. Such writers consider prototype-based languages to be true object-oriented languages that do not have classes, but in which objects instead inherit their code and data directly from other template objects. [[Self]] was the first prototype-based language, and well-documented examples include [[JavaScript]] and [[Lua (programming language)|Lua]].
In practice, the term "object-based" is usually applied to those object-based languages that are not also object-oriented. Although all object-oriented languages are also object-based, by definition. Instead the terms "object-based" and "object-oriented" are normally used as mutually exclusive alternatives, rather than as categories that overlap.
Sometimes the term "object-based" is applied to [[prototype-based languages]], true object-oriented languages that do not have classes, but in which objects instead inherit their code and data directly from other "template" objects. An example of a commonly used prototype-based language is [[JavaScript]].


Both object-based and object-oriented languages (whether class-based or prototype-based) may be statically type-checked. Statically checking prototype-based languages can be difficult because these languages often allow objects to be dynamically extended with new behavior, and even to have their parent object (from which they inherit) changed, at run time.<ref>{{cite journal|last=Wegner|first=Peter|title=Dimensions of Object-Based Language Design|journal=OOPSLA'87 Conference Proceedings|date=December 1987|volume=22|issue=12|pages=168--182|editor1-first=Norman|editor1-last=Meyrowitz}}</ref> <ref>{{cite journal|last=Barbey|first=S|coauthors=M. Kempe, and A. Strohmeier.|title=Object-Oriented Programming with Ada 9X|journal=Draft Technical Report|year=1993|url=http://www.adahome.com/9X/OOP-Ada9X.html|accessdate=15 December 2013|publisher=Swiss Federal Institute of Technology in Lausanne Software Engineering Laboratory|quote=Ada 83 itself is generally not considered to be object-oriented; rather, according to the terminology of Wegner [Weg 87], it is said to be object-based, since it provides only a restricted form of inheritance and it lacks polymorphism.}}</ref>
Both object-based and object-oriented languages (whether class-based or prototype-based) may be statically type-checked. Statically checking prototype-based languages can be difficult because these languages often allow objects to be dynamically extended with new behavior, and even to have their parent object (from which they inherit) changed, at run time.<ref>{{cite journal|last=Wegner|first=Peter|title=Dimensions of Object-Based Language Design|journal=OOPSLA'87 Conference Proceedings|date=December 1987|volume=22|issue=12|pages=168--182|editor1-first=Norman|editor1-last=Meyrowitz}}</ref> <ref>{{cite journal|last=Barbey|first=S|coauthors=M. Kempe, and A. Strohmeier.|title=Object-Oriented Programming with Ada 9X|journal=Draft Technical Report|year=1993|url=http://www.adahome.com/9X/OOP-Ada9X.html|accessdate=15 December 2013|publisher=Swiss Federal Institute of Technology in Lausanne Software Engineering Laboratory|quote=Ada 83 itself is generally not considered to be object-oriented; rather, according to the terminology of Wegner [Weg 87], it is said to be object-based, since it provides only a restricted form of inheritance and it lacks polymorphism.}}</ref>

Revision as of 10:50, 17 July 2014

The term "object-based language" may be used in a technical sense to describe any programming language that uses the idea of encapsulating state and operations inside "objects". Object-based languages need not support inheritance or subtyping, but those that do are also said to be "object-oriented". Object-based languages that do not support inheritance or subtyping are usually not considered to be true object-oriented languages.

Examples of object-oriented languages include Simula, Smalltalk, C++ (whose object model was based on Simula's), Objective-C (whose object model was based on Smalltalk's), Eiffel, Python, Ruby, Java, C#, and REALbasic (an object-oriented BASIC dialect). Examples of a language that is object-based but not object-oriented are early versions of Ada, Javascript, and Visual Basic (VB). These languages all support the definition of an object as a data structure but lack polymorphism and inheritance.

In practice, the term "object-based" is usually applied to those object-based languages that are not also object-oriented. Although all object-oriented languages are also object-based, by definition. Instead the terms "object-based" and "object-oriented" are normally used as mutually exclusive alternatives, rather than as categories that overlap.

Sometimes the term "object-based" is applied to prototype-based languages, true object-oriented languages that do not have classes, but in which objects instead inherit their code and data directly from other "template" objects. An example of a commonly used prototype-based language is JavaScript.

Both object-based and object-oriented languages (whether class-based or prototype-based) may be statically type-checked. Statically checking prototype-based languages can be difficult because these languages often allow objects to be dynamically extended with new behavior, and even to have their parent object (from which they inherit) changed, at run time.[1] [2]

References

  1. ^ Wegner, Peter (December 1987). Meyrowitz, Norman (ed.). "Dimensions of Object-Based Language Design". OOPSLA'87 Conference Proceedings. 22 (12): 168--182.
  2. ^ Barbey, S (1993). "Object-Oriented Programming with Ada 9X". Draft Technical Report. Swiss Federal Institute of Technology in Lausanne Software Engineering Laboratory. Retrieved 15 December 2013. Ada 83 itself is generally not considered to be object-oriented; rather, according to the terminology of Wegner [Weg 87], it is said to be object-based, since it provides only a restricted form of inheritance and it lacks polymorphism. {{cite journal}}: Unknown parameter |coauthors= ignored (|author= suggested) (help)