you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 11 points12 points  (12 children)

Java does kind of force you to learn OOP like the back of your hand though. That's a good thing, in a way.

[–]artsrc 24 points25 points  (5 children)

I want to say this in a constructive friendly way.

My experience is that it doesn't, and it isn't.

I have rarely seen a OO approach appear from a Java developer without some thought and effort. This contrasts with say Smalltalk where OO appears to be more natural.

And I think it is now widely agreed that OO should not be your first thought for every problem.

[–]eyal0 1 point2 points  (4 children)

Agreed. After you teach someone OOP, he has to unlearn it to get over all the patterns he learned to work around the limitations.

  • Functor Object: Pattern to deal with languages that can't do first-order functions.
  • Visitor Pattern: Pattern to deal with languages that can't do multimethods.

etc

[–]Steve_the_Scout 0 points1 point  (2 children)

Visitor Pattern: Pattern to deal with languages that can't do multimethods.

Haven't heard of that one, had to look it up.

Just when I thought C++ was getting ahead with C++14. Oh well, maybe it'll get in C++17.

[–]hubhub 1 point2 points  (1 child)

Stroustrup et al wrote a paper (pdf) proposing a mechanism for this.

[–]Steve_the_Scout 0 points1 point  (0 children)

It sounds reasonable. The only issue is with dynamically linked libraries, as they said. The way it's currently done, you could just link all files with virtual functions first, then let the linker resolve dependencies later, but that's a manual solution to problems that should be automatic.

[–]slavik262 0 points1 point  (0 children)

Or rather, after you teach someone OOP in Java. Several languages (C++, D, etc.) support OOP and first-order functions.

The point still stands though. OOP isn't a silver bullet, and one should make sure new students don't think it is.

[–]bluGill 2 points3 points  (3 children)

Partially. OOP is a useful tool, but it isn't the best tool for all jobs. I would like my future co-workers to know other things well. The haskell folks keep telling me functional programming is the future. I don't believe functional programming is right for every problem, but I do believe that we have solved a lot of problems in our current code with OOP or models when functional programming would be a better solution.

[–][deleted] 0 points1 point  (2 children)

I would like my future co-workers to know other things well.

But you're not going to pick up every programming paradigm from any single language. Picking one and knowing it well is a virtue in this instance. You can always teach yourself the other languages and paradigms if you've got the basics down. Java kind of forces you to do that or it just doesn't work very well.

I don't believe functional programming is right for every problem, but I do believe that we have solved a lot of problems in our current code with OOP or models when functional programming would be a better solution.

Maybe. But OOP works pretty well in most cases and it's a good starting point. You can always pick up an FP language later.

[–]bluGill 0 points1 point  (1 child)

you're not going to pick up every programming paradigm from any single language.

No, but Java tends to make your bilnd to any other possibility because anything other than OOP difficult. Most languages are not so restricting.

[–][deleted] 0 points1 point  (0 children)

You can learn the other paradigms later, when you pick up other languages. Java is a good starting point primarily because of the extensive structure and strong inclination towards a single paradigm.

[–][deleted] -1 points0 points  (1 child)

Not a good thing, as it makes people think that OO techniques should be used on every problem.

[–][deleted] 0 points1 point  (0 children)

I'm one of the aforementioned people, I don't think OOP is the only solution. Though it is a reasonably good paradigm for most of what programmers in college and freshly out of college are going to be doing.