Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (anonymous):

java is pure object oriented or not ?

OpenStudy (anonymous):

i would say yes

OpenStudy (anonymous):

Java is not a fully object oriented language because it does not support multiple inheritance directly.But it does so by using the concept of interfaces. A language is said to be fully object oriented if it supports classes,objects,inheritance and polymorphism.

OpenStudy (anonymous):

I disagree with Notalgebrasmart's definition of "pure OO". But let's hear yogesh_sahu's definition, because whether Java falls under it very strongly depends on this definition.

OpenStudy (farmdawgnation):

I did some basic research on this. It seems that one argument against Java being pure OO is that its primitive types are not objects. Check out http://stackoverflow.com/questions/2148559/looking-for-a-pure-object-oriented-language and scroll down. I'm not sure if I agree with Notalgebrasmart's definition either, but I'm admittedly not an expert. @shadowfiend might also have some thoughts on this.

OpenStudy (anonymous):

The most important attributes that distinguish "pure" OO languages from "mere" OO languages are, IMHO: All pre-defined types are Objects All operations performed by sending messages to Objects (objects etc. are requisites for OO in general, but to be "pure", these two must hold in addition) Smalltalk is such a language, as is Ruby (and Eiffel, but I've never used that), Java is not. Multiple implementation inheritance does not enter the picture, and is actually quite a problem.

OpenStudy (farmdawgnation):

Eh, it's not neccicarily a problem. Plenty of OO and Functional languages support the concept of Mixins, which is (at a basic level) the same thing in the end.

OpenStudy (anonymous):

Mixins are a dangerous concept. Just because plenty of languages support it doesn't make it less dangerous. C supports pointers. While useful, they are dangerous.

OpenStudy (shadowfiend):

I'm curious as to what you mean by dangerous. I generally see Java as not pure OO for precisely the reason @farmdawgnation linked to. Autoboxing of primitives is nice and all, but it's still not fully transparent. Scala is pure OO in that sense. Multiple inheritance is not a requirement for OO, though single inheritance is. Message-passing per se isn't really required, as it is a way of viewing method dispatch rather than a true feature. The result is typically the Smalltalk doesNotUnderstand:/Ruby method_missing functionality, a logical conclusion of “you talk to an object by sending a message”. Indeed, Eiffel calls their equivalent of messages or methods “features”, and a quick skimming does not indicate that it has the aforementioned functionality by consequence. That said, that's nitpicking. I assume you meant something broader, essentially that all operations are performed on some object.

OpenStudy (anonymous):

"Dangerous" in the context of programming languages means (to me) that these concepts have to be used very carefully because otherwise they can very easily lead to hard-to-find bugs. Multiple (implementation, not interface) inheritance falls under this category in my book, as do pointers.

OpenStudy (anonymous):

This guy has put forth his opinion on "oo-ness" of various languages: http://www.jvoegele.com/software/langcomp.html In Python, according to him (I'm not sure I agree, perhaps he is referring to Python 3, which I haven't used much yet), has all pre-defined types as objects, but no message passing (e. g. in Ruby you can call an operation on an integer; 1.doSomething()) Or perhaps I just don't see Python as pure OO because it has global functions like range() and len(). So would you consider Python "pure OO" or not?

OpenStudy (shadowfiend):

I wouldn't, though I actually haven't messed with Python very much at all, and certainly not Python 3. The trick for me is Ruby: Ruby has this wonderful thing where you can write a script without wrapping it an an object or a method or anything. The place where you realize Ruby is pure OO is when you realize that code you've written is actually running in an object context itself (the “main” object). I get your definition of dangerous. Software development is a skilled profession, though. Dangerous is another word for “very useful, with potential for abuse”. Like a chainsaw ;)

OpenStudy (farmdawgnation):

.... or FIRE. :D

OpenStudy (anonymous):

and there are tradeoffs between usefulness and danger, which for multiple implementation inheritance, while the danger is merely less maintainability (and for pointers is your program crashing (or worse: undetected buffer overruns that cause intermittent strangeness)) the gained power does not offset this danger (unlike fire, and chainsaws, especially rocket-propelled ones).

OpenStudy (shadowfiend):

Rocket-propelled chainsaws need to be an available weapon in Left 4 Dead. However, while I agree that things get pretty nightmarish in C++-style multiple inheritance, the linear nature of trait-based multiple inheritance makes it a lot easier to reason about. We've generally found few issues in navigating around our code, which makes reasonably extensive use of traits. It allows unrelated functions to be nicely modularized while being grouped into one cohesive whole. But, different strokes for different folks :)

OpenStudy (anonymous):

You've correctly guessed that my experience is mainly with the C++ variety (plus the lack of the concept in Java); I'm sure there are safe uses that I am yet to discover as I try some of the newer (and some old ones) languages in my copious free time.

OpenStudy (anonymous):

[really off now; l8er]

OpenStudy (anonymous):

Hey I'm only an IT Major in my senior year so I know nothing.lol

OpenStudy (anonymous):

I would say no because primitive types are not object e.g int, long, double etc, take a look at Ruby data types, everything is an object

OpenStudy (anonymous):

java is not pure oo languge it is object based language because java is not support multipal inheritance.

OpenStudy (anonymous):

no yogesh; multiple inheritence is not a defining quality of pure oo; having non-object types is, however. Smalltalk has no multiple inheritance, but it is one of the purest OO languages imaginable

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!