What is an Object?
by Niranjan Ramakrishnan
Of all the words in the lexicon of software technology, 'object' may be the most ambiguous, with the possible exception of that perennial joker card, 'system'.
The problem arises from a historical anamoly. Those who invented Simula (1967 - just imagine that!) called it an object-oriented language. It was a language based on classes. if they had simply called it class-oriented programming, there would have been no confusion. But they chose to call it object-oriented programming. It thus started with a paradox - a technology that depended on classes, but used a different (and somewhat opposite) term instead. From then on, terminology in this area has been in an Abu Ghraib of its own.
The relationship of classes to objects is a long and complicated one. It has been the dream of every programmer to have data that can be agglomerated, disciplined, predictable, able to hold both knowledge and action, yet be individually expandable. With classes, the first set of conditions were met. Individual expandability was restricted to variant behavior based on state or transient information (function parameters, say). There was no way an instance could overrule the template imposed by its class. The subtext of this was that every instance would belong to a class. Individual expandability (or contractability) is the distinct hallmark of an object.
In this sense a language like JavaScript is more object-oriented than a language like Java. In the former, you can add properties (including functions) to individual instances, without forcing them to belong to a class. This is true object-orientation -- a world built out of objects that are governed by their own properties and act according to their own lights, as opposed to class-orientation, where all instances are regimented according to pre-defined rules. Over time, there have been efforts to introduce languages to permit prototype-oriented programming even if not fully object-oriented programming, but most have these have remained in their own small arenas, while the larger world is dominated by strongly typed languages.
The first thing that pops into anyone's mind when called upon to differentiate an object-oriented language from a procedural one would be to use the word 'class'. Yet, when asked if object and class mean the same thing, the expert shifts from one foot to another, and launches into a discourse on meta classes and Russell's Paradox.
A better solution is to talk about classes and instances. Here the meanings are unambiguous. A class is a recipe, the instance is a product. No confusion. What is an object? Still a problem. An object is, from an academic view, technically the same as an instance. It is sloppy to refer to a class as an object, but the habit is so widespread it is practically impossible to enforce any verbal discipline. So, the best thing to do when you hear someone speaking of an object X is to ask, "Did you mean a class called X, or did you mean an instance called X?"
Archives: See PSJ Archives
Of all the words in the lexicon of software technology, 'object' may be the most ambiguous, with the possible exception of that perennial joker card, 'system'.
The problem arises from a historical anamoly. Those who invented Simula (1967 - just imagine that!) called it an object-oriented language. It was a language based on classes. if they had simply called it class-oriented programming, there would have been no confusion. But they chose to call it object-oriented programming. It thus started with a paradox - a technology that depended on classes, but used a different (and somewhat opposite) term instead. From then on, terminology in this area has been in an Abu Ghraib of its own.
The relationship of classes to objects is a long and complicated one. It has been the dream of every programmer to have data that can be agglomerated, disciplined, predictable, able to hold both knowledge and action, yet be individually expandable. With classes, the first set of conditions were met. Individual expandability was restricted to variant behavior based on state or transient information (function parameters, say). There was no way an instance could overrule the template imposed by its class. The subtext of this was that every instance would belong to a class. Individual expandability (or contractability) is the distinct hallmark of an object.
In this sense a language like JavaScript is more object-oriented than a language like Java. In the former, you can add properties (including functions) to individual instances, without forcing them to belong to a class. This is true object-orientation -- a world built out of objects that are governed by their own properties and act according to their own lights, as opposed to class-orientation, where all instances are regimented according to pre-defined rules. Over time, there have been efforts to introduce languages to permit prototype-oriented programming even if not fully object-oriented programming, but most have these have remained in their own small arenas, while the larger world is dominated by strongly typed languages.
The first thing that pops into anyone's mind when called upon to differentiate an object-oriented language from a procedural one would be to use the word 'class'. Yet, when asked if object and class mean the same thing, the expert shifts from one foot to another, and launches into a discourse on meta classes and Russell's Paradox.
A better solution is to talk about classes and instances. Here the meanings are unambiguous. A class is a recipe, the instance is a product. No confusion. What is an object? Still a problem. An object is, from an academic view, technically the same as an instance. It is sloppy to refer to a class as an object, but the habit is so widespread it is practically impossible to enforce any verbal discipline. So, the best thing to do when you hear someone speaking of an object X is to ask, "Did you mean a class called X, or did you mean an instance called X?"
Archives: See PSJ Archives
