Many Programming languages claim to be Object-Oriented. But there are seven qualities to be satisfied for a programming language to be pure Object Oriented. They are:
1. Encapsulation/Data Hiding
2. Inheritance
3. Polymorphism
4. Abstraction
5. All predifined types are objects
6. All operations are performed by sending messages to objects
7. All user defined types are objects.
A programming language can be considered as a “Pure” object oriented if it follows all above qualities. Here is a comparison which i found some days back.
|
Eiffel |
Smalltalk |
Ruby |
Java |
C# |
C++ |
Python |
Perl |
Visual Basic |
| Encapsulation / Information Hiding |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
Yes |
Yes |
| Inheritance |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
| Polymorphism / Dynamic Binding |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
Yes (through delegation) |
| All pre-defined types are Objects |
Yes |
Yes |
Yes |
No |
No |
No |
Yes |
No |
No |
| All operations are messages to Objects |
Yes |
Yes |
Yes |
No |
No |
No |
No |
No |
No |
| All user-defined types are Objects |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
Yes |
No |
No |
Java is not a pure object-oriented language. One of the reasons Java is not purely object-oriented is that not everything in it is an object. For example, Java allows you to declare variables of primitive types (int, float, boolean, etc.) that aren’t objects, Contrast with a pure OOP language like Smalltalk or Ruby where there are no primitive types, and boolean, int and methods are all objects. Also Java has static fields and methods, which are independent and separate from objects this violates real world reflection and object orientation.
I dont know much about Java but generally people say that native multiple inheritance is not supported by Java. I should clear that this post is not biased about any programming language. below is a comparison between the 3 most common language .
A brief overview of features of programming languages :
|
Eiffel |
Smalltalk |
Ruby |
Java |
C# |
C++ |
Python |
Perl |
Visual Basic |
| Object-Orientation |
Pure |
Pure |
Pure |
Hybrid |
Hybrid |
Hybrid / Multi-Paradigm |
Hybrid |
Add-On / Hybrid |
Partial Support |
| Static / Dynamic Typing |
Static |
Dynamic |
Dynamic |
Static |
Static |
Static |
Dynamic |
Dynamic |
Static |
| Generic Classes |
Yes |
N/A |
N/A |
No |
No |
Yes |
N/A |
N/A |
No |
| Inheritance |
Multiple |
Single |
Single class, multiple “mixins” |
Single class, multiple interfaces |
Single class, multiple interfaces |
Multiple |
Multiple |
Multiple |
None |
| Feature Renaming |
Yes |
No |
Yes |
No |
No |
No |
No |
No |
No |
| Method Overloading |
No |
No |
No |
Yes |
Yes |
Yes |
No |
No |
No |
| Operator Overloading |
Yes |
Yes? |
Yes |
No |
Yes |
Yes |
Yes |
Yes |
No |
| Higher Order Functions |
Agents (with version 5) |
Blocks |
Blocks |
No |
No |
No |
Lambda Expressions |
Yes (???) |
No |
| Lexical Closures |
Yes (inline agents) |
Yes (blocks) |
Yes (blocks) |
No |
No |
No |
Yes (since 2.1) |
Yes |
No |
| Garbage Collection |
Mark and Sweep or Generational |
Mark and Sweep or Generational |
Mark and Sweep |
Mark and Sweep or Generational |
Mark and Sweep or Generational |
None |
Reference Counting |
Reference Counting |
Reference Counting |
| Uniform Access |
Yes |
N/A |
Yes |
No |
No |
No |
No |
No |
Yes |
| Class Variables / Methods |
No |
Yes |
Yes |
Yes |
Yes |
Yes |
No |
No |
No |
| Reflection |
Yes (as of version 5) |
Yes |
Yes |
Yes |
Yes |
No |
Yes |
Yes? |
No |
| Access Control |
Selective Export |
Protected Data, Public Methods |
public, protected, private |
public, protected, “package”, private |
public, protected, private, internal, protected internal |
public, protected, private, “friends” |
Name Mangling |
None |
public, private |
| Design by Contract |
Yes |
No |
Add-on |
No |
No |
No |
No |
No |
No |
| Multithreading |
Implementation- Dependent |
Implementation- Dependent |
Yes |
Yes |
Yes |
Libraries |
Yes |
No |
No |
| Regular Expressions |
No |
No |
Built-in |
Standard Library |
Standard Library |
No |
Standard Library |
Built-in |
No |
| Pointer Arithmetic |
No |
No |
No |
No |
Yes |
Yes |
No |
No |
No |
| Language Integration |
C, C++, Java |
C |
C, C++, Java |
C, some C++ |
All .NET Languages |
C, Assembler |
C, C++, Java |
C, C++ |
C (via DCOM) |
<!–
| Automatic Documentation |
Yes |
No? |
Yes |
Yes |
No |
Yes |
Yes |
No |
–>
| Built-In Security |
No |
No? |
Yes |
Yes |
Yes |
No |
No? |
Yes (perlsec) |
No |
-Abhishek Singh
Like this:
Be the first to like this post.
Recent Comments