In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, 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 the domain of object-oriented programming an object is usually taken to mean a compilation 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 assigned a value, (like int =10), objects have to be “constructed”. In the real world, if a gun (let’s say a Colt 45) is an “object”, its physical properties and its function to shoot
would have been individually specified. Once the properties of this Colt 45 “object” had been specified into the form of a class (let’s call it ‘gun’), 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 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, 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 are used in software development to implement 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, simplification of software maintenance, the management of libraries, 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, as long as they all have the proper method.
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.
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.