Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What makes a language Object-Oriented?

Since debate without meaningful terms is meaningless, I figured I would point at the elephant in the room and ask: What exactly makes a language "object-oriented"? I'm not looking for a textbook answer here, but one based on your experiences with OO languages that work well in your domain, whatever it may be.

A related question that might help to answer first is: What is the archetype of object-oriented languages and why?

like image 542
Bruce Johnston Avatar asked Aug 26 '08 22:08

Bruce Johnston


2 Answers

Definitions for Object-Orientation are of course a huge can of worms, but here are my 2 cents:

To me, Object-Orientation is all about objects that collaborate by sending messages. That is, to me, the single most important trait of an object-oriented language.

If I had to put up an ordered list of all the features that an object-oriented language must have, it would look like this:

  1. Objects sending messages to other objects
  2. Everything is an Object
  3. Late Binding
  4. Subtype Polymorphism
  5. Inheritance or something similarly expressive, like Delegation
  6. Encapsulation
  7. Information Hiding
  8. Abstraction

Obviously, this list is very controversial, since it excludes a great variety of languages that are widely regarded as object-oriented, such as Java, C# and C++, all of which violate points 1, 2 and 3. However, there is no doubt that those languages allow for object-oriented programming (but so does C) and even facilitate it (which C doesn't). So, I have come to call languages that satisfy those requirements "purely object-oriented".

As archetypical object-oriented languages I would name Self and Newspeak.

Both satisfy the above-mentioned requirements. Both are inspired by and successors to Smalltalk, and both actually manage to be "more OO" in some sense. The things that I like about Self and Newspeak are that both take the message sending paradigm to the extreme (Newspeak even more so than Self).

In Newspeak, everything is a message send. There are no instance variables, no fields, no attributes, no constants, no class names. They are all emulated by using getters and setters.

In Self, there are no classes, only objects. This emphasizes, what OO is really about: objects, not classes.

like image 134
Jörg W Mittag Avatar answered Sep 25 '22 11:09

Jörg W Mittag


According to Booch, the following elements: Major:

  • Abstraction
  • Encapsulation
  • Modularity
  • Hierarchy (Inheritance)

Minor:

  • Typing
  • Concurrency
  • Persistence
like image 26
Vaibhav Avatar answered Sep 25 '22 11:09

Vaibhav