World Library  
Flag as Inappropriate
Email this Article

Object (computing)

Article Id: WHEBN0000169810
Reproduction Date:

Title: Object (computing)  
Author: World Heritage Encyclopedia
Language: English
Subject: Active Directory, Inspector window
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Object (computing)

In computer science, an object is a location in memory having a value and referenced by an identifier. An object can be a variable, function, or data structure. With the later introduction of object-oriented programming the same word, "object," refers to a particular instance of a class. In relational Database management an object can be a table or column in a relational database, or an association between data and a database entity (such as relating a person's age to a specific person).[1]

Object-oriented programming

Objects in "object-oriented programming" are essentially data structures together with their associated processing routines. For instance, a file is an object: a collection of data and the associated read and write routines. Objects are considered instances of classes. In common speech one refers to a file as a class, while the file itself is the object. A class defines properties and behaviour once, usually for multiple instances. This distinction has its counterparts in other disciplines, for example in biology and evolution [2] and is known as the genus/species dichotomy.

In the domain of object-oriented programming an object is usually taken to mean an ephemeral set of attributes (object elements) and behaviors (methods or subroutines) encapsulating an entity. In this way, while primitive or simple data types 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 given 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 laid out into the form of the car class, it can be endlessly copied to create identical objects that look and work in just the same way. As another 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 therefore have all the characteristics of the human class (and of the primate and animal superclasses as well).

"Objects" are the foundation of object-oriented programming, and are the foremost data types in object-oriented programming languages. These languages provide extensive syntactic and semantic support for object handling, including a hierarchical type system, special notation for declaring and calling methods, and facilities for hiding selected fields from client programmers. However, objects and object-oriented programming can be used in any language that features object-oriented programming.

Objects are used in software development to use abstract data structures, by bringing together the data components with the procedures that manipulate them. Objects in object-oriented programming are key in the concept of inheritance; thereby improving program reliability[attribution needed], making software maintenance[attribution needed] easier, the management of libraries, and the dividing of work in programmer teams. Object-oriented programming languages are generally made to use these potential advantages of the object model. Objects can also make it possible to handle very unalike objects by the same piece of code, as long as they all have the proper method.

Properties of an object

Three properties characterize objects:

  1. 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 by which the object can be used

Mechanism

Today's concept of "object" and the object-oriented approach to programming were introduced by the Simula programming language originally released in 1967, made popular by Smalltalk released two years later in 1969, and became standard tools of the trade with the spread of C++ originally released in 1983.

In the "pure" object-oriented approach, the data fields of an object should only be accessed through its methods (subroutines). 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 using 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. Creating an instance of a class is referred to as initializing the class.

A real-world example of an object would be "my dog", which is an instance of a type (a class) 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.

Specialized objects

There are certain specialized objects which can be created by the kind of Design Pattern 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

  • Function object: 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: 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: an object that can contain other objects.
  • Factory object: an object whose purpose is to create other objects.
  • Metaobject: an object from which other objects can be created (Compare with class, which is not necessarily an object)
  • Prototype: a specialized metaobject from which other objects can be created by copying
  • God object: an object that knows too much or does too much. The God object 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 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, can be carried over to the realm of distributed computing. Paradoxically, encapsulation does not extend to an object's behavior since they (or even their method names) are not serialized along with the data. A number of extensions to the basic concept of an object have been proposed that share these common characteristics:

  • Distributed objects are "ordinary" objects (objects in the usual sense - i.e. not OOP objects) that have been set up at a number of distinct remote locations, and communicate by exchanging messages over the network. Examples include web services and DCOM objects.
  • 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. 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[dubious ]. Examples include fault-tolerant CORBA objects.
  • Live distributed objects (or simply live objects)[3] 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 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.

Objects and the Semantic Web

It is claimed that the Semantic Web can be seen as a distributed data objects framework, and can therefore be seen as an object-oriented framework.[4][5] However, a distributed object is called an "ordinary" object, and not an OOP object because it is separated from its methods with which it was enclosed before. It is also claimed that it is valid to use a UML 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 also introduces Dereferenceable Uniform Resource Identifiers, which provide data-by-reference which is found in object-oriented programming and object-oriented databases in the form of object identifiers.

See also

References

External links

  • from The Java Tutorials
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.