naveen yadav wrote:first of all i would like to ask what does it mean to be pure object oriented language ?
Is java pure Object Oriented language ?
Depends on your definition of 'pure'. It's most certainly object-oriented, but some people reckon that the primitive types (int, long etc) make it "less pure". In C#, for example, even literals are objects, so you can write things like:
1.toString() and it's perfectly legal; and in Smalltalk, the code itself is an object, so there are plainly "levels of purity".
This thread may help you decide; but personally I doubt if there's a right or wrong answer.
Isn't it funny how there's always time and money enough to do it WRONG?
My opinion is that you should have used the search functionality of this site to find the countless previous discussions where no doubt this has been asked before. If other sites are anything to go by, these discussions were most likely as fruitless as all the other ones. For starters, what is your definiton of a "pure OO language"?
This is a question which is asked regularly on the forums here. The answer depends on what you regard as "pure" OO.
There are many different possible opinions: some people say that some programming language feature is OO, others say that it isn't. One example is what you already mentioned above: "expressions are not objects, so Java is not a pure OO language". Note that that's an opinion, not a fact that is objectively (pun not intended...) true. For every existing programming language you could probably argue that it has some feature which makes it not a perfectly pure OO language.
While the question "Is language X a pure OO language?" might be interesting to get you thinking what "object oriented" means exactly, don't expect to get a clear and definitive answer (for any language X).
naveen yadav wrote:there is nothing like Pure OO language
I disagree with this statement.
If I were to say "is there such a thing as a good politician", the answer would depend on how you define "good" (and possibly politician). A conservative's definition will be radically different than a liberal's, but both will have a pretty good idea of what makes a politician a 'good' one. Their lists would differ, however.
Java is a pure object-oriented language. An example of an object-oriented language that is not pure is C++. The difference in C++ is that you're able to (and actually even forced to) use the procedural paradigm, either exclusively or in addition to the object-oriented paradigm. For instance in C++ the main() function is located outside of any type - it exists basically on its own - whereas in Java, the main() method must reside within a class.
Basically in Java, all the criteria for an object-oriented language are met, and you are unable to step outside of OOP in that language.
But that's opinion, not fact. You can argue that since other languages are "more object-oriented" than Java, then by definition Java can't be entirely pure. For instance, to take your example, the main method in Java is in a class, but does not belong to an object. You can write a Java program without instantiating any objects, which doesn't seem all that pure to me. Compare to Scala, where the main method belongs to an object instance.
(Of course, none of this really matters, unless you enjoy the argument!)
Matthew Brown wrote:(Of course, none of this really matters, unless you enjoy the argument!)
Ah well, it's all grist for the OO mill, eh?
Personally, I reckon the most important thing is to know what the criteria for 'purity' (or indeed OOPLs in general) are, and why they are thought of as desirable.
It strikes me that the "impurest" languages (C++/Java) still seem to dominate the applications market, probably because
(a) they're flexible.
(b) they come from a familiar (and procedural) source - C.
whereas the 'pure boys' (Smalltalk, Eiffel, and possibly Ruby) are still the playthings of boffins and geeks.
VHS or Beta?
Joined: Oct 13, 2005
I did some work on an Eiffel Compiler about 5 years ago. Shortly before that, a new standard for Eiffel had been introduced, with major changes from the older versions, which made the language harder to compile and harder to use. In the subsequent two years, it went from about 15th place on Tiobe to one of the “too little difference in ranking to be worth noticing” crowd between 51 and 100. Not so much a case of purity versus impurity, more a case of annoying all the users so they stop using it.
Stephan van Hulst
Joined: Sep 20, 2010
When it comes to pure, Haskell and Lisp are pretty damn awesome. I still wouldn't write programs that matter in those languages, if it saved my life.