Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have good teacher who understands OOP. However, the language which he is expert in is Java and I don't want to learn Java.

My question is, do you think if I learn OOP using Java I will waste my time? And do you think it is good to start to learn OOP?

share|improve this question

closed as primarily opinion-based by MichaelT, GlenH7, Martijn Pieters, Kilian Foth, Bart van Ingen Schenau Feb 18 '14 at 9:48

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

" if I learn OOP using Java will I waste my time" No way... – Harry Joy Jun 18 '11 at 17:53
I took an OOP class in college, because I wanted to learn C++. They taught me Java. :) – George Marian Jun 18 '11 at 19:09
"But I don't want to learn Java" - Python could be a good alternative. – ssapkota Jun 19 '11 at 1:01
A good teacher can teach you object orientation without limiting it to a single language. (For that matter, the principles can be taught without programming at all.) When you use a specific language, whether it's Java, Python, or what-have-you, it's easy to muddy the waters with language-specific nuance. For example, in Java we might be talking about the class or the object, but not all object-oriented languages are class-based (Javascript for one). The take-away? Don't expect to understand OOP from one language after a single course. – kojiro Jun 19 '11 at 14:04
Look if your local library has got "James Rumbaugh, Michael Blaha, William Premerlani, Frederick Eddy, William Lorensen (1990). Object-Oriented Modeling and Design. Prentice Hall. ISBN 0-13-629841-9". It introduces object-orientation as a modelling technique and only later it discusses how to implement your object-oriented design in some concrete language. I found this reading very useful. – Giorgio Feb 15 '14 at 9:15

Java is a generally good OOP language. Sure it has fallen out of grace of the hipster hackers, but it is still one of the most used languages for OOP programming in the corporate world.

It's OOP principles are solid and you can draw valid comparisons between its design choices and other popular OOP languages like C++ and C# without any difficulty. Moreover, the design patterns applicable in OOP have almost always their Java version.

To sum up, if you have a good teacher that is willing to teach you OOP from Java, I would never dismiss such a good chance. However, if you want, you could complement it with comparing every principle you are taught with a couple other OOP languages version of it. That would help you achieve an almost agnostic OOP knowledge, that would ease a lot jumping to more trendy OOP languages.

share|improve this answer
Many design patterns are usually created to plug flaws in the language/paradigm. I don't think the fact that "the design patterns applicable in OOP have almost always their Java version" is a good thing. – R. Martinho Fernandes Jun 18 '11 at 19:24
Obviously all paradigms have their pitfalls and flaws. That being said, the fact that design patterns are potentially covering flaws in the OOP paradigm doesn't alter the fact that it is positive for an OOP language to let you use design patterns as a way to solve the flaws and shortcomings. We are not discussing, I think, if OOP is the panacea, which I don't think it is. – celebdor Jun 18 '11 at 19:29
@celebdor: I think it's an important point that Java offers nothing but it's own OOP in every situation, even when that isn't the right tool for the job, and that it confuses OOP and many other paradigms and doesn't even offer everything that OOP has to offer – DeadMG Jun 18 '11 at 19:34
To make my previous comment clearer: I think that using design patterns to OO-ify stuff that is dead simple in other paradigms is not a good thing. I think that "learning OOP" (good) is not the same as "learning how to make everything OOP" (bad). Like you said OOP is not the panacea. Why teach it as such? – R. Martinho Fernandes Jun 18 '11 at 19:40
The teacher is far more important than the language. If you like him, then go ahead and learn Java. If you have time, you can also start reading about another language that you may like better, and contrast the two. – kevin cline Jun 19 '11 at 2:30

Right now, I'd probably say no. For example, Java disallows multiple inheritance- because the implementation is a little icky. There's nothing in any OOP theories stating that multiple inheritance should not be allowed- this is Java, not OOP. Multiple inheritance is a perfectly valid part of OOP that you can never learn about using Java.

More importantly, I wouldn't use Java to teach OOP because you would come off with the impression that OOP solves every problem and it's a hammer and everything is a nail, when in reality, generic programming and functional programming both have significant advantages in certain situations. Learning about OOP is not just about learning that it can be used in X situation or Y situation, but also when it shouldn't be applied.

It will also teach that object orientation is linked to other principles- for example, objects can only be heap allocated. What is an object, and where the memory for a type is stored, are two unrelated ideas, but Java couples the two concepts- not to mention how it also couples reference vs value semantics to objects, and other things, which I find ironic, because object orientation is all about decreasing coupling.

If you want to learn about OOP, including when it's not so hot or when it's implementation goes beyond the blindingly obvious, and you don't want to know about all of the Java-specific stuff they added on, then Java isn't the right thing to do. C++ would be a much better choice- it isn't afraid to offer you alternative paradigms and let you make the choice. If you learn C++, then you will learn much, much more than if you learned Java, and you won't get confused between object orientation and memory management, or object orientation and reference vs value semantics, and that kind of thing. Of course, it's also harder, so you get what you pay for here.

Of course, having the advantage of an actual teacher cannot be underestimated.

share|improve this answer
As a side not I would recommend against C++ as the first serious language you learn, because it's simply overwhelming. – Raynos Jun 20 '11 at 14:22
The fact that Java is not allowing multiple inheritance is a good thing, not a bad thing. The problem of m.i. is nicely explained in this article:… – eddy147 Jun 23 '11 at 8:31
@eddy147: That's wrong. MI isn't perfect, that's no reason to disallow it. Just because in some cases it can be bad or ambiguous is no reason to throw it out. – DeadMG Aug 19 '11 at 12:52

I saw first reality aspects of object orientation in C++. After I switched to Java and now I am a C# fan.

Actually I have heard that SmallTalk is the real object oriented, but I cannot say anything for myself.

I agree with celebdor that good examples from books of patterns and blah blah are in Java. for example Martin Fowler is a Java fan, and you cannot miss his books at all.

At the end, yes don't miss a good teacher for Java. learning it is not that bad :)

share|improve this answer
+1 for actually mentioning SmallTalk. – Raynos Jun 20 '11 at 14:20

First, While Java will help you to learn OOP, you don't need it. Also. Java is not only OOP, but Generic, Imperative and structured. Theoretically speaking, Most OOP languages have a combination of other paradigms but OOP is the primary/dominat style form.

Seconds, You can learn OOP from any language that supports it. Having said that, I would recommend to pick a "a pure OOP" because you might combine OOP idoms with the idioms of other paradigms (multi-paradigm). Examples of "pure" OOP popular languages that will help you to keep OO focus, could be Scala and Ruby.

Lastly, you might one to pick an agnostic-language-book on Object Oriented Analysis and Design (OOAD). This will help you to disconnect from a language-specific OOP and think in a more generic term. An easy fun book (it might be too java centric for you) to read for me was


share|improve this answer
Please mention ""pure" OOP" and SmallTalk in the same sentence. – Raynos Jun 20 '11 at 14:18

I learned Java after I had learned VB.NET. I wished I had learned Java first, though, because I believe I learned the core concepts of OOP better in Java. And Java (or C#) is the next logical step if you've already worked in C based languages.

share|improve this answer
You're serious? VB.NET is pretty much C# in a verbose dress. I claim that you learning it better in Java is not related to the language, but to you and to how you relate to it. – R. Martinho Fernandes Jun 18 '11 at 19:20
And I agree. It probably didn't matter which language I learned second, it was just changing to another language that made me learn the actual OOP concepts behind the scenes. – MattK311 Jun 20 '11 at 22:16

Java is a very good OOP language so would be a fine choice for learning OOP principles. The principles you will learn will be applicable in pretty much any other OOP language.

One of the advantages Java has from a teaching perspective is a relatively simple syntax, so that you can concentrate on learning the core OOP principles rather than concerning yourself too much with the complexity of the language (which could be a problem with C++, for example, which contains much more sophisticated features).

Also Java is a good language in its own right. Ignore the "naysayers" who have a tendency to bash Java on account of it's slightly verbose "old fashioned" syntax and lack of trendy features - it's high performance, maintainable, portable, popular and has the best ecosystem of libraries and tools of any language.

My personal suggestion would therefore be to learn OOP with Java, then if you genuinely feel a need to learn a more "trendy" language later you can easily pick up Clojure, Groovy or Scala (which have the advantage of building upon the Java platform)

share|improve this answer
Java is not a very good OOP language. It's an average OOP language. Java has plenty of advantages, being a solid OOP language is not one of them – Raynos Jun 20 '11 at 14:19
@Raynos - having learnt and taught many languages I totally disagree. Java is a very good OOP language from a learning perspective which is the context of this question. It will teach you all of the necessary OOP basics. Of the OOP features that Java does not include, most can be "considered harmful": duck typing, mixins, monkey patching, multiple inheritance, syntactic sugar for getters/setters etc. are emphatically not required to learn OOP and in some cases can lead to very bad practices and unmaintainable code. – mikera Jun 20 '11 at 14:32
You've marked all the lovely and powerful meta programming tools that make OO a joy as "harmful". You've got a watered down version of OO under the argument that we're making code more secure/maintainable by taking the gun away so you can't shoot yourself. This is a perfectly viable option but that means Java is no longer a "very good" OOP language – Raynos Jun 20 '11 at 14:48
Maybe we just differ in opinion of what "very good" means then. When giving advice to beginners or typical organisations I prefer solid practices, maintainable code and long term productivity (assuming middling/average developers) above "joy to use" and advanced features that require considerable expertise to use safely. Beginners and average developers will shoot themselves in the foot more often than not in my experience. If you teach them solid foundations first, they are more likely to add value and have a successful career in the long run. They can have fun with Scala/Ruby then. YMMV. – mikera Jun 20 '11 at 14:59
@mikera there is the difference. I interpreted it as "Learn OOP theoretically", you interpreted it as "Learn OOP pragmatically". Sneak in a mindless edit and I'll undo the down vote because it's unfair. – Raynos Jun 20 '11 at 15:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.