Object-based language

From HandWiki
Revision as of 18:50, 6 February 2024 by Rtexter1 (talk | contribs) (simplify)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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 termed 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, in rough chronological order, include Simula, Smalltalk, C++ (which object model is based on Simula's), Objective-C (which object model is based on Smalltalk's), Eiffel, Xojo (formerly REALbasic), Python, Ruby, Java, Visual Basic .NET, C#, and Fortran 2003. Examples of a language that is object-based, but not object-oriented are early versions of Ada, Visual Basic (VB), and Fortran 90. 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 programming languages, true object-oriented languages that lack classes, but in which objects instead inherit their code and data directly from other template objects. An example of a commonly used prototype-based scripting 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 runtime.[1][2]

Difference between object-oriented and object-based languages
Object-oriented language Object-based language
Object-oriented languages support all of the features of object-oriented programming (OOP): abstraction, encapsulation, inheritance, polymorphism Object-based languages support a subset of the features of OOP, such as polymorphism or inheritance.[citation needed]
Examples: C++, C#, Java, etc. Examples: Visual Basic (pre-.NET)[citation needed]

References

  1. Wegner, Peter (December 1987). "Dimensions of object-based language design". in Meyrowitz, Norman. Conference proceedings on Object-oriented programming systems, languages and applications - OOPSLA '87. 22. pp. 168–182. doi:10.1145/38765.38823. ISBN 0897912470. http://www.cse.msu.edu/~stire/cse891f04/wegner.pdf. 
  2. Barbey, S.; Kempe, M.; Strohmeier, A. (1993). "Object-Oriented Programming with Ada 9X". Draft Technical Report (Swiss Federal Institute of Technology in Lausanne Software Engineering Laboratory). http://www.adahome.com/9X/OOP-Ada9X.html. 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.".