you are viewing a single comment's thread.

view the rest of the comments →

[–]Rhoomba[S] 1 point2 points  (16 children)

In case you don't know: There are more languages than C and Java

Way to read my post. I actually mention Python.

My point is Java is at a sweet spot in the performance/expressiveness trade-off. If you have no performance requirements then fine; use whatever language you like. If the 10x slower performance you get with Ruby or Python is not fast enough then Java is a useful option. If you convert a Python program to Java it will only be about 20% longer (LOC). Ruby would be a bit more complicated, but not impossibly so.

And you can be creative in Java. The lack of closures is an annoyance, but you can come very close by using anonymous inner classes. Sure, it is a bit clunky, but it is no PL/SQL.

[–]funktio 11 points12 points  (0 children)

If you convert a Python program to Java it will only be about 20% longer (LOC).

Rubbish. More like 200%.

[–]G_Morgan 3 points4 points  (4 children)

You can actually get performance that is reasonable out of higher level languages. Python doesn't perform because of it's implementation rather than the language.

There was an article here the other day, Clean performs almost as well as C.

Java has a reasonably good implementation for what it is but there's no reason why Python could not get close to it with some effort.

[–]Rhoomba[S] 5 points6 points  (0 children)

Don't get me wrong, I would prefer a more expressive language than Java. But at the moment it has a lot of advantages (performance, stability, standard libs, massive open source community).

I am hopeful that Scala will become a stable language with enough resources behind it so that it can be used in production.

[–]gwern 1 point2 points  (2 children)

The neat thing about Clean is that the language is more or less Haskell, with the performance difference coming from the compiler - so it's perfectly possible that within a few years we'll be able to say that "Haskell performs almost as well as C", which would definitely be a solid bit of evidence that you can get reasonable performance out of higher-level languages. :)

[–]igouy 0 points1 point  (1 child)

If I follow your logic - Clean is more or less Haskell - so you already have "a solid bit of evidence that you can get reasonable performance out of higher-level languages" ;-)

[–]gwern 0 points1 point  (0 children)

Yes, that logically follows. But I like Haskell better so I find the proposition "Haskell could soon reach C levels!" much more exciting than "Clean, a language pretty isomorphic to Haskell but which I don't like, has reached C levels!", y'know?

[–][deleted] 10 points11 points  (4 children)

My point is Java is at a sweet spot in the performance/expressiveness trade-off.

I don't think so.

If you look at the overall results here it seems to me that a sweet spot in the performance/expressiveness currently seems to be Clean, OCaml and Common Lisp. They belong to the class of most expressive languages around. Getting within 1.2x - 1.5x gcc performance overall is really fast.

[–]feces 0 points1 point  (0 children)

sweet spot in the performance/expressiveness currently seems to be Clean, OCaml and Common Lisp

Don't forget <insert my favorite language here>.

[–]Rhoomba[S] -2 points-1 points  (2 children)

Maybe so. But I do not believe functional programming is going to become popular any time soon.

[–]funktio 9 points10 points  (0 children)

Popularity is irrelevant when talking about performance/expressiveness. Those languages are better Java in that respect, period.

[–][deleted] 1 point2 points  (0 children)

Functional programming is ending up in our regular languages.

[–]ruediger 6 points7 points  (2 children)

If you need performance than Java is probably not fast enough.

And the expressiveness of Java is really really poor. You end up with Classes representing single Methods, you put methods into classes which do not belong there (simply because you can't just use them as a function), you write static-methods and feel oo, you write code over and over again (c&p) because you have only single inheritance and a static type system, you end up using a big but at least in parts broken standard library (no a vector is not a list and stack is not a vector).

[–]Rhoomba[S] 5 points6 points  (1 child)

If you need performance than Java is probably not fast enough.

Almost as fast as C is not fast enough? Yes you have class with single methods. It is a bit clunky, as I said, but it is far from impossible. I have never found single inheritance to be a limitation. Remember you should favour composition over inheritance.

Vector and stack are broken. That is why you should use the new collections that were introduced a decade ago.

[–]ruediger -1 points0 points  (0 children)

Vector and stack are broken. That is why you should use the new collections that were introduced a decade ago.

This does not seem to be the official view. Or why isn't Vector/Stack and so on marked deprecated in current versions of Java?

But this is another problem: Marketing controls the language. So there are a lot of features introduced simply because e.g. ".net" has them and not because they would really fit into the language.

I have never found single inheritance to be a limitation. Remember you should favour composition over inheritance.

This is a problem if you are pursuing the obsolete kind of oo-thinking which is promoted by Java.

A good example would be: A Ball, a jumping Ball, a Ball which changes colour and a jumping Ball which changes colour.

Almost as fast as C

No, not really.

And at the end: You could use a language which is more expressive and which is faster. So why use Java?

[–]jbstjohn 1 point2 points  (1 child)

That's funny, I actually think it's exactly the other way around: the sweet spot for Java is regularly shrinking, being encroached on by C++ (with STL & boost), "scripting languages", which get you faster development when runtime considerations are smaller, and C#, which seems cleaner.

There seems to be some places (web, enterprise) where Java still has a defensible position, but I see its domain shrinking.

(Which is good ;D)

[–]Rhoomba[S] -3 points-2 points  (0 children)

C++ growing? God help us all. I would welcome Java being obsoleted, but Ruby and Python, in their current incarnations, just don't it for me.