What is meant by the term "true" object orientation What is meant by the term "true" object orientation ruby ruby

What is meant by the term "true" object orientation


It's a subjective term used to promote languages. I've seen it used to say C# and Java are true object oriented languages in comparison to C++ because everything must be in a class (no global functions or variables) and all objects inherit from one Object class.

For Ruby, it may refers to how Ruby treats everything as an object, so you could write 1.to_s, instead of something like str(1) or String.valueOf(1). This is because Ruby makes no distinction between value and reference variables. In Javascript there are no classes and you just create extensible objects that could be cloned for reuse, this style of programming is known as Prototype-based programming.

C++ on the other hand is advertised as a multi-paradigm language that allows you to use several approaches such as object-oriented, generic and procedural programming. It doesn't stick to one paradigm.

But yeah, it's just a subjective term that could mean anything. Generally it refers to whether the language puts more emphasis on objects as opposed to other language elements like functions, templates, etc. Wikipedia's article on SmallTalk calls it a 'pure' object oriented language, and the description applies to Ruby as well:

Smalltalk is a 'pure' OO language, meaning that, unlike Java and C++, there is no difference between values which are objects and values which are primitive types. In Smalltalk, primitive values such as integers, booleans and characters are also objects, in the sense that they are instances of corresponding classes, and operations on them are invoked by sending messages. A programmer can change the classes that implement primitive values, so that new behavior can be defined for their instances--for example, to implement new control structures--or even so that their existing behavior will be changed. This fact is summarised in the commonly heard phrase "In Smalltalk everything is an object" (which would more accurately be expressed as "all values are objects", as variables aren't).


The C++ issue is the following. C++ classes exist only in the source syntax. There's no run-time class object with attributes and methods.

In Python, everything's an object. An object's class is another object, with it's own methods and attributes. This is true of the smalltalk environment, also, which is a kind of benchmark of object-orientation.

I think the "true" object-orientation refers to those environments where everything's an object.

[Java falls short of this because it has primitive types.]


I think it may be referring to Prototype Based Programming, a Programming Paradigm in which:

Classes are not present, and behavior reuse (known as inheritance in class-based languages) is performed via a process of cloning existing objects that serve as prototypes. This model can also be known as class-less, prototype-oriented or instance-based programming.

See also Ruby singleton methods.