I have been hearing a lot about Ruby and possibly even Javascript being ‘true’ object oriented languages as opposed to C++ and C# which are class oriented (or template based) languages. What is meant by true OO and what are the advantages of this over the class/template approach?
Share
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 likestr(1)orString.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: