Object (computer science)
Encyclopedia
In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, an object is any entity that can be manipulated by the commands of a programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

, such as a value
Value (computer science)
In computer science, a value is an expression which cannot be evaluated any further . The members of a type are the values of that type. For example, the expression "1 + 2" is not a value as it can be reduced to the expression "3"...

, variable, function
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

, or data structure
Data structure
In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...

. (With the later introduction of object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 the same word, "object", refers to a particular instance of a class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

)

Object-oriented programming

In the domain of object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 an object is usually taken to mean an ephemeral
Ephemeral
Ephemeral things are transitory, existing only briefly. Typically the term is used to describe objects found in nature, although it can describe a wide range of things....

 compilation of attributes (object elements) and behaviors (methods or subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s) encapsulating an entity. In this way, while primitive or simple data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

s are still just single pieces of information, object-oriented objects are complex types that have multiple pieces of information and specific properties (or attributes). Instead of merely being assigned a value, (like int =10), objects have to be "constructed". In the real world, if a Ford Focus is an "object" - an instance of the car class, its physical properties and its function to drive would have been individually specified. Once the properties of the Ford Focus "object" had been specified into the form of the car class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

, it can be endlessly copied to create identical objects that look and function in just the same way. As an alternative example, animal is a superclass of primate and primate is a superclass of human. Individuals such as Joe Bloggs or John Doe would be particular examples or 'objects' of the human class, and consequently possess all the characteristics of the human class (and of the primate and animal superclasses as well).

"Objects" are the foundation of object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

, and are fundamental data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

s in object-oriented programming language
Object-oriented programming language
This is a list of object-oriented programming programming languages.-Languages with object-oriented features:*ABAP*Ada 95*AmigaE*BETA*Blue*Boo*C++*C#*COBOL*Cobra*ColdFusion*Common Lisp*COOL*CorbaScript*Clarion*CLU*Curl*D*Dylan*E*Eiffel...

s. These languages provide extensive syntactic
Syntax
In linguistics, syntax is the study of the principles and rules for constructing phrases and sentences in natural languages....

 and semantic
Semantics
Semantics is the study of meaning. It focuses on the relation between signifiers, such as words, phrases, signs and symbols, and what they stand for, their denotata....

 support for object handling, including a hierarchical type system
Type system
A type system associates a type with each computed value. By examining the flow of these values, a type system attempts to ensure or prove that no type errors can occur...

, special notation for declaring and calling methods, and facilities for hiding
Information hiding
In computer science, information hiding is the principle of segregation of the design decisions in a computer program that are most likely to change, thus protecting other parts of the program from extensive modification if the design decision is changed...

 selected fields from client programmers. However, objects and object-oriented programming can be implemented in any language.

Objects are used in software development
Software engineering
Software Engineering is the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software, and the study of these approaches; that is, the application of engineering to software...

 to implement abstract data structures
Abstract data type
In computing, an abstract data type is a mathematical model for a certain class of data structures that have similar behavior; or for certain data types of one or more programming languages that have similar semantics...

, by bringing together the data components with the procedures that manipulate them. Objects in object-oriented programming are key in the concept of inheritance
Inheritance (object-oriented programming)
In object-oriented programming , inheritance is a way to reuse code of existing objects, establish a subtype from an existing object, or both, depending upon programming language support...

; thereby improving program reliability , simplification of software maintenance
Software maintenance
Software Maintenance in software engineering is the modification of a software product after delivery to correct faults, to improve performance or other attributes....

, the management of libraries
Library (computer science)
In computer science, a library is a collection of resources used to develop software. These may include pre-written code and subroutines, classes, values or type specifications....

, and the division of work in programmer teams. Object-oriented programming languages are generally designed to exploit and enforce these potential advantages of the object model. Objects can also make it possible to handle very disparate objects by the same piece of code
Source code
In computer science, source code is text written using the format and syntax of the programming language that it is being written in. Such a language is specially designed to facilitate the work of computer programmers, who specify the actions to be performed by a computer mostly by writing source...

, as long as they all have the proper method.

Properties of an Object

Three properties characterize objects:
  1. Identity
    Identity (object-oriented programming)
    An identity in object-oriented programming, object-oriented design and object-oriented analysis describes the property of objects that distinguishes them from other objects. This is closely related to the philosophical concept of identity....

    : the property of an object that distinguishes it from other objects
  2. State: describes the data stored in the object
  3. Behavior: describes the methods in the object's interface
    Interface (computer science)
    In the field of computer science, an interface is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software...

     by which the object can be used

Mechanism

The modern concept of "object" and the object-oriented approach to programming were introduced by the Simula
Simula
Simula is a name for two programming languages, Simula I and Simula 67, developed in the 1960s at the Norwegian Computing Center in Oslo, by Ole-Johan Dahl and Kristen Nygaard...

 programming language originally released in 1967, popularized by Smalltalk
Smalltalk
Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis." It was designed and created in part for educational use, more so for constructionist...

 released two years later in 1969, and became standard tools of the trade with the spread of C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 originally released in 1983.

In the "pure" object-oriented approach, the data fields of an object should only be accessed through its methods (subroutine
Subroutine
In computer science, a subroutine is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code....

s). It is claimed that this rule makes it easy to guarantee that the data will always remain in a valid state.
Syntactically, in almost all object-oriented programming languages, a dot(.) operator (placed between an object and its symbolic method name) is used to call a particular method/function of an object. For example, consider an arithmetic class named Arith_Class. This class contains functions like add, subtract, multiply and divide, that process results for two numbers given to them. This class could be used to find the product of 78 and 69 by first creating an object of the class and then invoking its multiply method, as follows:

1 int result = 1 ; // Initialization
2 arith_Obj1 = new Arith_Class; // Creating a new object of Arith_Class
3 result = arith_Obj1.multiply(78,69); // returned value of multiply function, store in result variable.

In a language where each object is created from a class, an object is called an instance of that class. If each object has a type, two objects with the same class would have the same data type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

. Creating an instance of a class is sometimes referred to as instantiating the class.

A real-world example of an object would be "my dog", which is an instance of a type
Data type
In computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...

 (a class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

) called "dog", which is a subclass of a class "animal". In the case of a polymorphic object, some details of its type can be selectively ignored, for example a "dog" object could be used by a function looking for an "animal". So could a "cat", because it too belongs to the class of "animal". While being accessed as an "animal", some member attributes of a "dog" or "cat" would remain unavailable, such as the "tail" attribute, because not all animals have tails.

A "ghost" is an object that is unreferenced
Reference (computer science)
In computer science, a reference is a value that enables a program to indirectly access a particular data item, such as a variable or a record, in the computer's memory or in some other storage device. The reference is said to refer to the data item, and accessing those data is called...

 in a program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...

, and can thus serve no purpose. In a garbage-collected language, the garbage collector
Garbage collection (computer science)
In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by objects that are no longer in use by the program...

 marks the memory occupied by the object as free, although it still holds the object's data until it is overwritten.

Specialized Objects

There are certain specialized objects which can be created by the kind of Design Pattern
Design pattern
A design pattern in architecture and computer science is a formal way of documenting a solution to a design problem in a particular field of expertise. The idea was introduced by the architect Christopher Alexander in the field of architecture and has been adapted for various other disciplines,...

 which is used for creating them and usually those objects are named after their design patterns themselves. Some terms for specialized kinds of objects include
  • Singleton
    Singleton pattern
    In software engineering, the singleton pattern is a design pattern used to implement the mathematical concept of a singleton, by restricting the instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system...

     object: An object that is the only instance of its class during the lifetime of the program.
  • Functor (function object
    Function object
    A function object, also called a functor, functional, or functionoid, is a computer programming construct allowing an object to be invoked or called as though it were an ordinary function, usually with the same syntax.-Description:...

    ): 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
    Immutable object
    In object-oriented and functional programming, an immutable object is an object whose state cannot be modified after it is created. This is in contrast to a mutable object, which can be modified after it is created...

    : an object set up with a fixed state at creation time and which does not vary afterward.
  • First-class object
    First-class object
    In programming language design, a first-class citizen , in the context of a particular programming language, is an entity that can be constructed at run-time, passed as a parameter, returned from a subroutine, or assigned into a variable...

    : an object that can be used without restriction.
  • Container
    Container (data structure)
    In computer science, a container is a class, a data structure, or an abstract data type whose instances are collections of other objects. In other words; they are used for storing objects in an organized way following specific access rules...

    : an object that can contain other objects.
  • Factory object
    Factory object
    In object-oriented computer programming, a factory is an object for creating other objects. It is an abstraction of a constructor, and can be used to implement various allocation schemes. For example, using this definition, singletons implemented by the singleton pattern are formal factories.A...

    : an object whose purpose is to create other objects.
  • Metaobject
    Metaobject
    In computer science, a metaobject or meta-object is any entity that manipulates, creates, describes, or implements other objects. The object that the metaobject is about is called the base object...

    : an object from which other objects can be created (Compare with class
    Class (computer science)
    In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...

    , which is not necessarily an object)
  • Prototype: a specialized metaobject from which other objects can be created by copying
  • God object
    God object
    In object-oriented programming, a God object is an object that knows too much or does too much. The God object is an example of an anti-pattern....

    : an object that knows too much or does too much. The God object is an example of an anti-pattern
    Anti-pattern
    In software engineering, an anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice.The term was coined in 1995 by Andrew Koenig,...

    .
  • Filter object
    Filter object
    In object-oriented programming, a filter object is an object which receives a stream of data as its input and produces the stream of data as its output based on the data from input stream. So a filter object filters an input data transforming it into output data.Often the input and output streams...


Objects in distributed computing

The definition of an object as an entity that has a distinct identity, state, and behavior, and, it is claimed, the principle of encapsulation
Information hiding
In computer science, information hiding is the principle of segregation of the design decisions in a computer program that are most likely to change, thus protecting other parts of the program from extensive modification if the design decision is changed...

, can be carried over to the realm of distributed computing
Distributed computing
Distributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...

. Paradoxically, encapsulation does not extend to an object's behavior since they (or even their method names) are not serialized
Serialization
In computer science, in the context of data storage and transmission, serialization is the process of converting a data structure or object state into a format that can be stored and "resurrected" later in the same or another computer environment...

 along with the data. A number of extensions to the basic concept of an object have been proposed that share these common characteristics:
  • Distributed object
    Distributed object
    The term distributed objects usually refers to software modules that are designed to work together, but reside either in multiple computers connected via a network or in different processes inside the same computer. One object sends a message to another object in a remote machine or process to...

    s are "ordinary" objects (objects in the usual sense - i.e. not OOP objects) that have been deployed at a number of distinct remote locations, and communicate by exchanging messages over the network. Examples include web service
    Web service
    A Web service is a method of communication between two electronic devices over the web.The W3C defines a "Web service" as "a software system designed to support interoperable machine-to-machine interaction over a network". It has an interface described in a machine-processable format...

    s and DCOM
    Component Object Model
    Component Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...

     objects.
  • Protocol objects are components of a protocol stack
    Protocol stack
    The protocol stack is an implementation of a computer networking protocol suite. The terms are often used interchangeably. Strictly speaking, the suite is the definition of the protocols, and the stack is the software implementation of them....

     that encapsulate network communication within an object-oriented interface.
  • Replicated objects
    Replication (computer science)
    Replication is the process of sharing information so as to ensure consistency between redundant resources, such as software or hardware components, to improve reliability, fault-tolerance, or accessibility. It could be data replication if the same data is stored on multiple storage devices, or...

     are groups of distributed objects (called replicas) that run a distributed multi-party protocol to achieve a high degree of consistency between their internal states, and that respond to requests in a coordinated manner. Referring to the group of replicas jointly as an object reflects the fact that interacting with any of them exposes the same externally visible state and behavior. Examples include fault-tolerant CORBA
    Çorba
    Chorba , ciorbă , shurpa , shorpo , or sorpa is one of various kinds of soup or stew found in national cuisines across Middle East...

     objects.
  • Live distributed object
    Live distributed object
    - Definitions :The term live distributed object refers to a running instance of a distributed multi-party protocol, viewed from the object-oriented perspective, as an entity that has a distinct identity, may encapsulate internal state and threads of execution, and that exhibits a well-defined...

    s (or simply live objects
    Live distributed object
    - Definitions :The term live distributed object refers to a running instance of a distributed multi-party protocol, viewed from the object-oriented perspective, as an entity that has a distinct identity, may encapsulate internal state and threads of execution, and that exhibits a well-defined...

    ) 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 invocation
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...

 or protocol composition
Protocol stack
The protocol stack is an implementation of a computer networking protocol suite. The terms are often used interchangeably. Strictly speaking, the suite is the definition of the protocols, and the stack is the software implementation of them....

). Others, such as replicated objects and live distributed objects, are more non-standard, in that they abandon the assumption 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.

Objects and the Semantic Web

It is claimed that the Semantic Web
Semantic Web
The Semantic Web is a collaborative movement led by the World Wide Web Consortium that promotes common formats for data on the World Wide Web. By encouraging the inclusion of semantic content in web pages, the Semantic Web aims at converting the current web of unstructured documents into a "web of...

 can be seen as a distributed data objects framework, and can therefore be validly seen as an object-oriented framework. However, a distributed object is regarded as an "ordinary" object, and not an OOP object because it is separated from its methods with which it was previously encapsulated. It is also claimed that it is valid to use a UML
Unified Modeling Language
Unified Modeling Language is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created, by the Object Management Group...

 diagram to express a Semantic Web graph.

Both the Semantic Web and object-oriented programming have:
  • Classes
  • Attributes (also known as Relationships)
  • Instances


Furthering this, Linked Data
Linked Data
In computing, linked data describes a method of publishing structured data so that it can be interlinked and become more useful. It builds upon standard Web technologies such as HTTP and URIs, but rather than using them to serve web pages for human readers, it extends them to share information in a...

 also introduces Dereferenceable Uniform Resource Identifier
Dereferenceable Uniform Resource Identifier
A dereferenceable Uniform Resource Identifier or dereferenceable URI is a resource retrieval mechanism that uses any of the internet protocols A dereferenceable Uniform Resource Identifier or dereferenceable URI is a resource retrieval mechanism that uses any of the internet protocols A...

s, which provide data-by-reference which is found in object-oriented programming and object-oriented databases in the form of object identifiers.

See also

  • Object lifetime
    Object lifetime
    In computer science, the object lifetime of an object in object-oriented programming is the time between an object's creation till the object is no longer used, and is destructed or freed.In object-oriented programming , the meaning of creating objects is far more subtle than simple...

  • Object copy
    Object copy
    An object copy is an action in computing where a data object has its attributes copied to another object of the same data type. An object is a composite data type in object-oriented programming languages. The copying of data is one of the most common procedures that occurs in computer programs...

  • Design pattern (computer science)
    Design pattern (computer science)
    In software engineering, a design pattern is a general reusable solution to a commonly occurring problem within a given context in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that...

  • Business object (computer science)
    Business object (computer science)
    A business object is a type of an intelligible entity being an actor inside the business layer in an n-layered architecture of object-oriented computer programs....

  • Actor model
    Actor model
    In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK