Thursday, December 12, 2019

Is Coffee A Pure Object Oriented Programming Language?

One of the oldest enquiry related to Java is whether Java a pure object oriented linguistic communication or not?Short respond is no, There are many things inward Java which are non objects e.g. primitive information types e.g. boolean, char, short, int, long, float, double, unlike kinds of arithmetic, logical too bitwise operator e.g. +, -. *, /, &&, || etc. Few pure OO languages are Smalltalk and Eiffel. Though Java is ane of the most successful Object oriented programming language, which too got to a greater extent than or less functional programming touching on inward Java 8 is never considered 100% or pure object-oriented programming language. If it were, all its primitives would live on objects. It genuinely moves half-way inward this direction alongside String (and maybe Array), only it doesn't quite brand it enough. Actually, ane could struggle that equally String and Array aren't inheritable, that makes those parts of Java at best object-based.


Is Java is Pure Object Oriented language?

There are 7 qualities to live on satisfied for a programming linguistic communication to live on pure Object Oriented. They are:

1. Encapsulation/Data Hiding

2. Inheritance

3. Polymorphism

4. Abstraction

5. All predefined types are objects

6. All operations are performed yesteryear sending messages to objects

7. All user defined types are objects.

If yous hold off at these 7 qualities, Java does satisfy most of them. Java supports Encapsulation at flat too packet level, It supports Abstraction, Inheritance too Polymorphism, too all user defined types are too objects. What it doesn't back upward is #5, all predefined types are non objects inward Java, because yous tin define primitive types. This agency it too violates #6. That's why Java is non a pure object oriented language.



Why Java is non Pure Object Oriented language? 

 One of the oldest enquiry related to Java is  Is Java a Pure Object Oriented Programming Language?Smalltalk is oftentimes considered ane of the purest Object oriented linguistic communication too comparison Java alongside Smalltak will plow over yous sufficient reasons, why Java is non 100% object oriented language. Following betoken makes feel to me.

1) Primitive information types are either stored guide inward fields or on the stack rather than on the heap. This is the reason Java is non considered a pure OO programming language

2) If nosotros accept to assort inward "pure OO" or "non-pure OO" nosotros accept a problem. It’s improve to utter virtually "purity levels". Smalltalk has a higher purity flat than Java. "Primitive types" inward Smalltalk are genuinely "Primitive Classes" too inward Smalltalk all "procedures" or "functions" are genuinely messages


On closing notes, You tin brand your plan pure object oriented yesteryear using Autoboxing, only Java compiler supports primitive information types, too therefore Java cannot live on Pure object oriented unless it makes everything inward damage of objects. In short, Java is non pure object oriented programming linguistic communication because it supports primitive information types too everything is non object inward Java. Let me know what is your idea on this, practise yous reckon Java pure object oriented language? If not, tin yous scream back of reasons due to which Java is non 100% object oriented language?
Further Learning
SOLID Principles of Object Oriented Design
Absolute Introduction to Object Oriented Programming inward Java
Java - Object Oriented Programming [For Absolute Beginners]

No comments:

Post a Comment