In
computer science, an object can be a
variable
Variable may refer to:
* Variable (computer science), a symbolic name associated with a value and whose associated value may be changed
* Variable (mathematics), a symbol that represents a quantity in a mathematical expression, as used in many ...
, a
data structure
In computer science, a data structure is a data organization, management, and storage format that is usually chosen for efficient access to data. More precisely, a data structure is a collection of data values, the relationships among them, a ...
, a
function, or a
method. As regions of
memory, they contain
value
Value or values may refer to:
Ethics and social
* Value (ethics) wherein said concept may be construed as treating actions themselves as abstract objects, associating value to them
** Values (Western philosophy) expands the notion of value beyo ...
and are referenced by
identifiers.
In the
object-oriented programming
paradigm
In science and philosophy, a paradigm () is a distinct set of concepts or thought patterns, including theories, research methods, postulates, and standards for what constitute legitimate contributions to a field.
Etymology
''Paradigm'' comes f ...
, ''object'' can be a combination of variables, functions, and data structures; in particular in
class-based
Class-based programming, or more commonly class-orientation, is a style of object-oriented programming (OOP) in which inheritance (object-oriented programming), inheritance occurs via defining ''class (computer programming), classes'' of object ...
variations of the paradigm it refers to a particular
instance
Instantiation or instance may refer to:
Philosophy
* A modern concept similar to ''participation'' in classical Platonism; see the Theory of Forms
* The instantiation principle, the idea that in order for a property to exist, it must be had by ...
of a
class
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differentl ...
.
In the
relational model
The relational model (RM) is an approach to managing data using a Structure (mathematical logic), structure and language consistent with first-order logic, first-order predicate logic, first described in 1969 by English computer scientist Edgar F. ...
of
database management, an object can be a
table or
column
A column or pillar in architecture and structural engineering is a structural element that transmits, through compression, the weight of the structure above to other structural elements below. In other words, a column is a compression member. ...
, or an association between data and a database entity (such as relating a person's age to a specific person).
Object-based languages
An important distinction in programming languages is the difference between an object-oriented language and an object-based language. A language is usually considered object-based if it includes the basic capabilities for an object: identity, properties, and attributes. A language is considered object-oriented if it is object-based and also has the capability of
polymorphism
Polymorphism, polymorphic, polymorph, polymorphous, or polymorphy may refer to:
Computing
* Polymorphism (computer science), the ability in programming to present the same programming interface for differing underlying forms
* Ad hoc polymorphis ...
, inheritance, encapsulation, and, possibly, composition. Polymorphism refers to the ability to overload the name of a function with multiple behaviors based on which object(s) are passed to it. Conventional message passing discriminates only on the first object and considers that to be "sending a message" to that object. However, some object-oriented programming languages such as
Flavors
Flavor or flavour is either the sensory perception of taste or smell, or a flavoring in food that produces such perception.
Flavor or flavour may also refer to:
Science
*Flavors (programming language), an early object-oriented extension to Lis ...
and the
Common Lisp Object System (CLOS) enable discriminating on more than the first parameter of the function. Inheritance is the ability to subclass an object class, to create a new class that is a subclass of an existing one and inherits all the data constraints and behaviors of its parents but also adds new and/or changes one or more of them.
Object-oriented programming
Object-oriented programming is an approach to designing modular reusable software systems. The object-oriented approach is an evolution of good design practices that go back to the very beginning of computer programming. Object-orientation is simply the logical extension of older techniques such as
structured programming
Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection ( if/then/else) and repetition ( ...
and
abstract data types. An object is an abstract data type with the addition of
polymorphism
Polymorphism, polymorphic, polymorph, polymorphous, or polymorphy may refer to:
Computing
* Polymorphism (computer science), the ability in programming to present the same programming interface for differing underlying forms
* Ad hoc polymorphis ...
and
inheritance.
Rather than structure programs as code and data, an object-oriented system integrates the two using the concept of an "object". An object has state (data) and behavior (code). Objects can correspond to things found in the real world. So for example, a graphics program will have objects such as ''circle'', ''square'', ''menu''. An online shopping system will have objects such as ''shopping cart, customer, product''. The shopping system will support behaviors such as ''place order'', ''make payment'', and ''offer discount''. The objects are designed as class hierarchies. So for example with the shopping system there might be high level classes such as ''electronics product'', ''kitchen product'', and ''book''. There may be further refinements for example under ''electronic products'': ''CD Player, DVD player'', etc. These classes and subclasses correspond to
set
Set, The Set, SET or SETS may refer to:
Science, technology, and mathematics Mathematics
*Set (mathematics), a collection of elements
*Category of sets, the category whose objects and morphisms are sets and total functions, respectively
Electro ...
s and
subset
In mathematics, Set (mathematics), set ''A'' is a subset of a set ''B'' if all Element (mathematics), elements of ''A'' are also elements of ''B''; ''B'' is then a superset of ''A''. It is possible for ''A'' and ''B'' to be equal; if they are ...
s in mathematical logic.
Specialized objects
An important concept for objects is the
design pattern. A design pattern provides a reusable template to address a common problem. The following object descriptions are examples of some of the most common design patterns for objects.
*
Function object
In computer programming, a function object is a construct allowing an object to be invoked or called as if it were an ordinary function, usually with the same syntax (a function parameter that can also be a function). Function objects are often ca ...
: an object with a single method (in C++, this method would be the function operator, "operator()") that acts much like a function (like a C/C++ pointer to a function).
*
Immutable object
In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created.Goetz et al. ''Java Concurrency in Practice''. Addison Wesley Professional, 2006, Section 3.4 ...
: an object set up with a fixed state at creation time and which does not change afterward.
*
First-class object: an object that can be used without restriction.
*
Container object: an object that can contain other objects.
*
Factory object
In object-oriented programming, a factory is an object (computer science), object for object creation, creating other objects; formally, it is a Subroutine, function or Method (computer programming), method that returns objects of a varying prot ...
: an object whose purpose is to create other objects.
*
Metaobject: an object from which other objects can be created (compare with a
class
Class or The Class may refer to:
Common uses not otherwise categorized
* Class (biology), a taxonomic rank
* Class (knowledge representation), a collection of individuals or objects
* Class (philosophy), an analytical concept used differentl ...
, which is not necessarily an object).
*
Prototype object: a specialized metaobject from which other objects can be created by copying
*
God object
In object-oriented programming, a god object (sometimes also called an omniscient or all-knowing object) is an object that references a large number of distinct types, has too many unrelated or uncategorized methods, or some combination of both ...
: an object that knows or does too much (it is an example of an
anti-pattern).
*
Singleton object: an object that is the only instance of its class during the lifetime of the program.
*
Filter object
In computer science, an object can be a variable, a data structure, a function, or a method. As regions of memory, they contain value and are referenced by identifiers.
In the object-oriented programming paradigm, ''object'' can be a combinati ...
: an object that receives a stream of data as its input and transforms it into the object's output. Often the input and output streams are streams of characters, but these also may be streams of arbitrary objects. These are generally used in wrappers since they conceal the existing implementation with the abstraction required at the developer side.
Distributed objects
The object-oriented approach is not just a programming model. It can be used equally well as an
interface definition language
interface description language or interface definition language (IDL), is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs describe an inter ...
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.
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.
*''
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
Live distributed object (also abbreviated as ''live object'') refers to a running instance of a distributed multi-party (or peer-to-peer) protocol, viewed from the object-oriented perspective, as an entity that has a distinct identity, may encaps ...
s'' (or simply ''
live objects'') 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 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 (OWL) and the
Resource Description Framework The Resource Description Framework (RDF) is a World Wide Web Consortium (W3C) standard originally designed as a data model for metadata. It has come to be used as a general method for description and exchange of graph data. RDF provides a variety of ...
(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
In distributed computing, distributed objects are objects (in the sense of object-oriented programming) that are distributed across different address spaces, either in different processes on the same computer, or even in multiple computers connec ...
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 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 The closed-world assumption (CWA), in a formal system of logic used for knowledge representation, is the presumption that a statement that is true is also known to be true. Therefore, conversely, what is not currently known to be true, is false. Th ...
". If a fact is not known to the system that fact is assumed to be false. Semantic Web objects use the
open-world assumption
In a formal system of logic used for knowledge representation, the open-world assumption is the assumption that the truth value of a statement may be true irrespective of whether or not it is ''known'' to be true. It is the opposite of the close ...
, 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 languages 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:
See also
*
*
*
*
*
References
External links
''What Is an Object?''from ''The Java Tutorials''
{{DEFAULTSORT:Object (computer science)
Object-oriented programming
Data types
Composite data types