File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java pure Object Oriented language ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java pure Object Oriented language ?" Watch "java pure Object Oriented language ?" New topic
Author

java pure Object Oriented language ?

naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384

hi ranchers ,

first of all i would like to ask what does it mean to be pure object oriented language ?
Is java pure Object Oriented language ?
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7795
    
  21

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.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
Of course there is a right answer. It’s the opposite of what you think
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384


the link provided by Winston Gutkowski : what i understands is java is not pure OO language because

1). expression are not objects like (if(a>b)
2). late binding and overriding does not happen for static method .

share your opinion.

Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
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"?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14150
    
  18

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).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

Here is some reading you can do on the subject


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384


Lesson learnt :
there is nothing like Pure OO language.and java is OO language.

thanks for putting your views.
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11314
    
  16

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.
John McClellan
Ranch Hand

Joined: Aug 15, 2011
Posts: 35
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.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

Disagree. You can still define members on the class level, and Java has primitives. In Java you can make many programs in a purely procedural way.
John McClellan
Ranch Hand

Joined: Aug 15, 2011
Posts: 35
When you can't make behavior exist outside of a type, that is not procedural programming. Furthermore I don't belive the existence of primitives makes a language less object-oriented.
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4391
    
    8

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!)
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7795
    
  21

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?

Winston
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
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
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  16

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.
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

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.


i have to disagree with that statement since i have personally written some very top-down procedural(translate not OO programs in my early days using java. and i could again if i wanted to)

for example: it is very easy using inner classes to totally avoid OO principles.


SCJP
Visit my download page
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java pure Object Oriented language ?