• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java pure Object Oriented language ?

 
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Marshal
Posts: 79151
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course there is a right answer. It’s the opposite of what you think
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Saloon Keeper
Posts: 7582
176
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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"?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is some reading you can do on the subject
 
naveen yadav
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

thanks for putting your views.
 
fred rosenberger
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic