Object (computer science): Difference between revisions

Content deleted Content added
shorted discussion on OOP and object-based since was long winded for little value
JuUunIOr (talk | contribs)
No edit summary
 
(23 intermediate revisions by 9 users not shown)
Line 1:
{{Short description|ArbitrarilySoftware defined datasetabstraction with specified properties used instate, somebehavior, programmingand paradigmsidentity}}
 
In [[computersoftware sciencedevelopment]], an '''object''' canis be aan [[variable (computer science)|variableentity]], a [[data structure]],that ahas [[subroutine|function]], or a [[MethodState (computer programmingscience)|methodstate]]. As regions of, [[Memory address|memorybehavior]], objects contain a [[Value (computer science)|value]] and are referenced by [[identifierIdentity (computerobject-oriented programming)|identifiersidentity]].
<ref name="ooa">{{cite book|title=Object-Oriented Analysis and Design with Applications |edition=3 |date=April 30, 2007 |author1=Grady Booch |author2=Robert Maksimchuk |author3=Michael Engle |author4=Bobbi Young |author5=Jim Conallen |author6=Kelli Houston |isbn=978-0201895513 |publisher= Addison-Wesley Professional}}</ref>
<ref name="Why Natural Scientists Should Care
About Object-Oriented Technology">http://www.literateprogramming.com/quantumoo.pdf</ref>
{{rp|78}} An object can [[model]] some part of [[reality]] or can be an [[invention]] of the [[design process]] whose collaborations with other such objects serve as the mechanisms that provide some higher-level behavior. Put another way, an object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem ___domain.<ref name="ooa"></ref>{{rp|76}}
 
InA [[object-oriented programming language]] (OOP),can be classified based on its support for objects. A language that provides an objectencapsulation construct for state, behavior, and identity is anclassified as [[abstractobject-based data typelanguage|object-based]]. withIf the additionlanguage also ofprovides [[polymorphism (computer science)|polymorphism]] and [[inheritance (object-oriented programming)|inheritance]]. Anit object-orientedis system integrates code and dataclassified as objects[[Object-oriented that each have state (data) and behavior (code)programming|object-oriented]]. AnyA language that supports acreating constructan withobject statefrom and behavior is classified asa [[object-basedclass language(computer science)|object-basedclass]]. Inis aclassified as [[class-based programming|class-based]]. A language, anthat supports object iscreation anvia alsoa knowntemplate asobject anis [[Instanceclassified (computer science)|instance]] of aas [[classprototype-based (computer science)programming|classprototype-based]].
In the [[relational model]] of [[database]] management, an object can be a [[Table (database)|table]] or [[Column (database)|column]], or an association between data and a database entity (such as relating a person's age to a specific person).<ref name=Oppel>{{cite book |first=Andy |last=Oppel |title=SQL Demystified |publisher=McGraw Hill |year=2005| page=7 |isbn=0-07-226224-9}}</ref>
 
The concept of object is used in many different software contexts, including:
==Design patterns==
 
* Possibly the most common use is [[Computer memory|in-memory]] objects in a [[computer program]] written in an object-based language.
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 |last=Martin |first=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>
 
* [[Information systems]] can be [[object-oriented analysis and design|modeled]] with objects representing their components and interfaces.<ref name="ooa"/>{{rp|39}}
*[[Function object]]: with a single method (in C++, the function operator, <code>operator()</code>) it acts much like a function
* In the [[relational model]] of [[database]] management, anaspects objectsuch can be aas [[Table (database)|table]] orand [[Column (database)|column]], ormay an association between data and a database entity (suchact as relating a person's age to a specific person)objects.<ref name=Oppel>{{cite book |first=Andy |last=Oppel |title=SQL Demystified |publisher=McGraw Hill |year=2005| page=7 |isbn=0-07-226224-9}}</ref>
 
* [[Distributed object|Objects]] of a [[distributed computing]] system tend to be larger grained, longer lasting, and more service-oriented than programming objects.
*[[Immutable object]]: does not change state after creation
 
In purely object-oriented programming languages, such as [[Java]] and [[C Sharp (programming language)|C#]], all classes might be part of an inheritance tree such that the root class is <code>Object</code>, meaning all objects instances of <code>Object</code> or implicitly extend <code>Object</code>.
*[[First-class object]]: can be used without restriction
 
*[[Container (data structure)|Container object]]: contains other objects
 
*[[Factory object]]: creates other objects
 
*[[Metaobject]]: from which other objects can be created (compare with a [[class (computer science)|class]], which is not necessarily an object)
 
*[[Prototype pattern|Prototype object]]: a specialized metaobject from which other objects can be created by copying
 
*[[God object]]: knows or does too much; example of an [[anti-pattern]]
 
*[[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
 
==Distributed objects==
{{main|Distributed object}}
 
The object-oriented approach is not just a programming model. It can be used equally well as an [[interface description language|interface definition language]] for distributed systems. The objects in a [[distributed computing]] model tend to be larger grained, longer lasting, and more service-oriented than programming objects.
 
A standard method to package distributed objects is via an Interface Definition Language (IDL). An IDL shields the client of all of the details of the distributed server object. Details such as which computer the object resides on, what [[programming language]] it uses, what [[operating system]], and other platform-specific issues. The IDL is also usually part of a distributed environment that provides services such as transactions and persistence to all objects in a uniform manner. Two of the most popular standards for distributed objects are the [[Object Management Group]]'s [[CORBA]] standard and [[Microsoft]]'s DCOM.<ref>{{cite book|last=Orfali|first=Robert|title=The Essential Client/Server Survival Guide|year=1996|publisher=Wiley Computer Publishing|___location=New York|isbn=0-471-15325-7|pages=[https://archive.org/details/essentialclients00orfa/page/399 399–403]|url=https://archive.org/details/essentialclients00orfa/page/399}}</ref>
 
In addition to distributed objects, a number of other extensions to the basic concept of an object have been proposed to enable distributed computing:
*''Protocol objects'' are components of a [[protocol stack]] that enclose network communication within an object-oriented interface.
*''[[Replication (computer science)|Replicated objects]]'' are groups of distributed objects (called ''replicas'') that run a distributed multi-party protocol to achieve high consistency between their internal states, and that respond to requests in a coordinated way. Examples include fault-tolerant [[CORBA]] objects.
*''[[Live distributed object]]s'' (or simply ''[[live distributed object|live objects]]'')<ref>Ostrowski, K., Birman, K., Dolev, D., and Ahnn, J. (2008). "Programming with Live Distributed Objects", ''Proceedings of the 22nd European Conference on Object-Oriented Programming'', Paphos, Cyprus, July 07–11, 2008, J. Vitek, Ed., ''Lecture Notes in Computer Science'', vol. 5142, Springer-Verlag, Berlin, Heidelberg, 463-489, http://portal.acm.org/citation.cfm?id=1428508.1428536.</ref> generalize the ''replicated object'' concept to groups of replicas that might internally use any distributed protocol, perhaps resulting in only a weak consistency between their local states.
 
Some of these extensions, such as ''distributed objects'' and ''protocol objects'', are ___domain-specific terms for special types of "ordinary" objects used in a certain context (such as [[remote method invocation]] or [[protocol stack|protocol composition]]). Others, such as ''replicated objects'' and ''live distributed objects'', are more non-standard, in that they abandon the usual case that an object resides in a single ___location at a time, and apply the concept to groups of entities (replicas) that might span across multiple locations, might have only weakly consistent state, and whose membership might dynamically change.
 
==The Semantic Web==
The [[Semantic Web]] is essentially a distributed-objects framework. Two key technologies in the Semantic Web are the [[Web Ontology Language]] (WOL) and the [[Resource Description Framework]] (RDF). RDF provides the capability to define basic objects—names, properties, attributes, relations—that are accessible via the Internet. OWL adds a richer object model, based on set theory, that provides additional modeling capabilities such as [[multiple inheritance]].
 
OWL objects are not like standard large-grained [[distributed objects]] accessed via an Interface Definition Language. Such an approach would not be appropriate for the Internet because the Internet is constantly evolving and standardization on one set of interfaces is difficult to achieve. OWL objects tend to be similar to the kinds of objects used to define application ___domain models in programming languages such as [[Java (programming language)|Java]] and [[C++]].
 
However, there are important distinctions between OWL objects and traditional object-oriented programming objects. Traditional objects get compiled into static hierarchies usually with single inheritance, but OWL objects are dynamic. An OWL object can change its structure at run time and can become an instance of new or different classes.
 
Another critical difference is the way the model treats information that is currently not in the system. Programming objects and most database systems use the "[[closed-world assumption]]". If a fact is not known to the system that fact is assumed to be false. Semantic Web objects use the [[open-world assumption]], a statement is only considered false if there is actual relevant information that it is false, otherwise it is assumed to be unknown, neither true nor false.
 
OWL objects are actually most like objects in artificial intelligence [[frame language]]s such as [[KL-ONE]] and Loom.
 
The following table contrasts traditional objects from Object-Oriented programming languages such as Java or C++ with Semantic Web Objects:<ref>{{cite journal|last=Berners-Lee|first=Tim|author2=James Hendler|author3=Ora Lassila|title=The Semantic Web A new form of Web content that is meaningful to computers will unleash a revolution of new possibilities|journal=Scientific American|date=May 17, 2001|url=http://www.cs.umd.edu/~golbeck/LBSC690/SemanticWeb.html|doi=10.1038/scientificamerican0501-34|volume=284|pages=34–43|url-status=dead|archive-url=https://web.archive.org/web/20130424071228/http://www.cs.umd.edu/~golbeck/LBSC690/SemanticWeb.html|archive-date=April 24, 2013}}</ref><ref>{{cite web|url=http://www.w3.org/2001/sw/BestPractices/SE/ODSD/|title=A Semantic Web Primer for Object-Oriented Software Developers|last1=Knublauch|first1=Holger|last2=Oberle|first2=Daniel|last3=Tetlow|first3=Phil|last4=Wallace|first4=Evan|publisher=[[W3C]]|date=2006-03-09|access-date=2008-07-30}}</ref>
 
{| class="wikitable"
|-
! OOP Objects !! Semantic Web Objects
|-
| Classes are regarded as types for instances. || Classes are regarded as sets of individuals.
|-
| Instances can not change their type at runtime. || Class membership may change at runtime.
|-
| The list of classes is fully known at compile-time and cannot change after that. || Classes can be created and changed at runtime.
|-
| Compilers are used at build-time. Compile-time errors indicate problems. || Reasoners can be used for classification and consistency checking at runtime or build-time.
|-
| Classes encode much of their meaning and behavior through imperative functions and methods. || Classes make their meaning explicit in terms of OWL statements. No imperative code can be attached.
|-
| Instances are anonymous insofar that they cannot easily be addressed from outside of an executing program. || All named RDF and OWL resources have a unique URI under which they can be referenced.
|-
| Closed world: If there is not enough information to prove a statement true, then it is assumed to be false. || Open world: If there is not enough information to prove a statement true, then it may be true or false.<ref>Table excerpted from tables in: http://www.w3.org/2001/sw/BestPractices/SE/ODSD/</ref>
|}
 
==See also==
*{{annotated link|Actor model}}
*{{annotated link|Business object}}
*{{annotated link|Instance (computer science)}}
*{{annotated link|Object lifetime}}
*{{annotated link|Object copying}}
*{{annotated link|BusinessSemantic objectWeb}}
*{{annotated link|Actor model}}
 
==References==