| This article may need to be rewritten entirely to comply with Wikipedia's quality standards. You can help. The discussion page may contain suggestions. (August 2009) |
In computer science, an object, in the domain of object-oriented programming, usually means a compilation of attributes (object elements) and behaviors (methods) encapsulating an entity. However, outside the object-oriented programming domain, the word object may simply mean any entity that can be manipulated by the commands of a programming language, such as a value (computer science), variable, function, or data structure.
"Objects" are the foundation of object-oriented programming, and are fundamental 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 implemented in any language.
Objects have proven[citation needed] to be very helpful in software development, particularly for large programs. For one thing, they are a natural way[citation needed] to implement abstract data structures, by "physically" bringing together the data components with the procedures that manipulate them. More importantly, they make it possible to handle very disparate objects by the same piece of code, as long as they all have the proper method. They also improve program reliability[citation needed], simplify software maintenance[citation needed], the management of libraries[citation needed], and the division of work in programmer teams[citation needed]. Object-oriented programming languages are generally designed to exploit and enforce these potential advantages of the object model.
Contents |
History
The modern concept of "object" and the object-oriented approach to programming were introduced by the Simula programming language originally released in 1967, popularized by Smalltalk released two years later in 1969, and became standard tools of the trade with the spread of C++ originally released in 1983.
| This section requires expansion. |
Object-oriented programming
In the "pure" object-oriented approach, the data fields of an object should only be accessed through the methods (subroutines). This rule makes it easy to guarantee that the data will always remain in a valid state.
Object-oriented languages
| It has been suggested that this article or section be merged into object-oriented programming language. (Discuss) |
Some languages do not make distinctions between data members and methods.
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 firstly creating an object of the class and then invoking its multiply method, as follows:
1 int result = 1 0; // Initialization 2 arith_Obj1 = new Arith_Class(); // Creating a new instance of Arith_Class 3 result = arith_Obj1.multiply(78,69); // Product of 78 and 69 stored 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 datatype. 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 (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.
A 'ghost' is an object that is unreferenced in a program, and can therefore serve no purpose. In a garbage-collected language, the garbage collector would mark the memory occupied by the object as free, although it would still contain the object's data until it was overwritten.
Three properties characterize objects:
- Identity: the property of an object that distinguishes it from other objects
- State: describes the data stored in the object
- Behavior: describes the methods in the object's interface by which the object can be used
Some terms for specialized kinds of objects include:
- Singleton object: An object that is the only instance of its class during the lifetime of the program.
- Functor (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 vary 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.
- Antiobjects: a computational metaphor useful to conceptualize and solve hard problems often with massively parallel approaches by swapping computational foreground and background.....
- Filter object
Objects in distributed computing
The definition of an object as an entity that has a distinct identity, state, and behavior, and the principle of encapsulation, can be carried over to the realm of distributed computing. 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) that have been deployed 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 encapsulate 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 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 objects.
- Live distributed objects (or simply live objects)[1] 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 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
The Semantic Web can be seen as a distributed data objects framework, and therefore can be validly seen as an Object Oriented Framework [2][3]. It is also quite 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 Unified Resource Identifiers, which provide Data-by-Reference which you find in Object Oriented Programming and Object Oriented Databases in the form of Object Identifiers.
See also
References
- ^ 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.
- ^ Knublauch, Holger; Oberle, Daniel; Tetlow, Phil; Evan (2006-03-09). "A Semantic Web Primer for Object-Oriented Software Developers". W3C. http://www.w3.org/2001/sw/BestPractices/SE/ODSD/. Retrieved 2008-07-30.
- ^ Connolly, Daniel (2002-08-13). "An Evaluation of the World Wide Web with respect to Engelbart's Requirements". W3C. http://www.w3.org/Architecture/NOTE-ioh-arch. Retrieved 2008-07-30.
External links
- What Is an Object? from The Java Tutorials
|
||||||||||||||||||||
|
||||||||||||||||||||||||||
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)




