8 February 2010

Why Java is not Purely Object Oriented? royalarun.blogspot.com


Many languages claim to be Object-Oriented. While the exact definition of the term is highly variable depending upon who you ask, there are several qualities that most will agree an Object-Oriented language should have:

1.Encapsulation/Information Hiding
3.Polymorphism/Dynamic Binding
4.All pre-defined types are Objects
5.All operations performed by sending messages to Objects
6.All user-defined types are Objects

For the purposes of this discussion, a language is considered to be a "pure" Object-Oriented languages if it satisfies all of these qualities. A "hybrid" language may support some of these qualities, but not all. In particular, many languages support the first three qualities, but not the final three.

Eiffel, Smalltalk, and Ruby are all pure Object-Oriented languages, supporting all six qualities listed above. Java claims to be a pure Object-Oriented language, but by its inclusion of "basic" types that are not objects, it fails to meet our fourth quality. It fails also to meet quality five by implementing basic arithmetic as built-in operators, rather than messages to objects.

C++ is considered to be a multi-paradigm language, of which one paradigm it supports is Object-Orientation. Thus, C++ is not (nor does it contend to be) a pure Object-Oriented language.

Java, while it does not support pure implementation inheritance, provides two separate inheritance mechanisms. The extends keyword is used for a combination of implementation and subtype inheritance while the implements keyword is used for pure subtype (interface) inheritance.

No comments:

Post a Comment

Comments Welcome