I don't get why people complain so much about Java. It's definitely not perfect, but it's not a complicate language to use. People complain that it is slow; well it's much faster than dynamic languages. People complain that it is verbose. Yeah, maybe more compared to dynamically typed languages. But personnaly, I don't have much of an issue with Java. It's not hard to read, not hard to write, and to my experience, its runtime behavior is easy to predict.
When I look at benchmarks of languages (notably this [1]), and compare Java to say Ruby or Python, it's about 40 times faster, and compare pretty well versus C++. And I'd rather code something in Java than in C++ everyday, all the time.
Now I'm not versed in the benchmarking of languages, and I don't care that much about them as I understand that they are not very reliable. But when I need a lil'more performance than Python or Ruby, but that I don't want to ruin my psychological balance with C++, I'm quite happy to have Java.
Maybe it's just my lack of knowledge that gets me to have this opinion. Maybe once I get a chance to try out Go and Scala, I'll find there is no reason to use Java anymore. But I don't think I'll get to the opinion that is it terrible and that it deserves to be hated and laughed at.
My problem with java is not the language itself. It is the bloated, over-engineered frameworks that were built on top of it that way too many companies bought into. See EJB2, JSF, etc... Way too many java frameworks make the job at hand harder.
A huge smell to me is that java frameworks have... frameworks... which have frameworks to finally arrive at a frankenstein's monster that is semi usable until its not and then woe-be-the-engineer saddled with its architecture. JSF is by itself is unproductive to develop with, so frameworks like RichFaces rose on top of it, which were also not enough, so other frameworks like Seam rose on top of them. And one feature of Seam is to make the JSF event-based framework behave more like an action-based framework ala struts or spring MVC. Maybe this should beg the question, "WTF are we doing with this dubiously helpful technology (JSF) at the foundation of our (web) technology stack?"
Its interesting to me that many "new" languages getting implemented are built on the JVM (or are old languages ported to java). I expect the JVM will outlive Java by a long margin.
People complain that it is verbose. Yeah, maybe more compared to weakly typed languages.
I think you mean dynamically typed, which is not the same as weakly. But even that is not true: there are plenty of statically typed languages which are nowhere are verbose as Java, due to cultural differences, type inference, first-class functions, pattern matching, etc.
Try out Scala. It's a superior substitute for Java in every possible way.
And even if my last statement is hyperbole, you can still use Java in your scala project for the critical parts where scala doesn't do a good enough job. Sbt, the standard scala build tool typically builds you src/main/scala and src/main/java folders. Write scala in the scala folders, java in the java folders, they can easily refer to each other, it's all seamless.
That is not true, you can program such an unmaintainable mess in Scala that is just not possible in Java.
You don't have to implement every programming feature just because it exists.
That makes Scala inferior in reality.
In my opinion the reason why Scala will never be mainstream. There has to be a balance between features and simplicity.
For a language that will "never be mainstream" it seems to be picking up steam pretty fast. We're very happy with it. Sensibly written Scala code is much easier to read than Java, and that's coming from someone who has been using Java for a long long time.
It's funny my boss was thinking of trying Scala, but the more he learned about it the more he became disillusioned.
I remember reading somewhere that although you might decide to limit use of Scala language facilities (as there are too many of them), you'll still have to deal with them when trying to understand how libraries work (for debugging purposes for example).
It's not only core libraries, all the available libraries that your project depends upon will one day or the other have to be debugged. I mean I had to debug Hibernate and it was a pain, I can't imagine debugging something written with advanced Scala features that I'm not very confident with.
Only problem is the scala community is teeny tiny, tool support isn't there (There isn't an IDE with a scala plugin that fully supports scala), pure scala libraries tend to be unreadable and lack any solid documentation (looking at you scalaz, lift, and dispatch), and I think most importantly the scala compiler is SLOW.
I've written a bunch of production Scala code, and I'm glad to have gotten away from it. Obviously to each their own.
I find scalaz quite readable, though admittedly I'm using Scala as an overcomplicated Haskell on the JVM rather than a superior Java. So my use pattern is mainly "which scalaz feature copies the haskell feature I want?" rather than "how can I use this lib to help me?" Haven't used lift or dispatch, so I'll take your word for it.
As for a small community, it hasn't bothered me. I get to cheat and use all the java libs.
Regarding compiler speed, I get the impression it's much worse on a mac than on linux (I use the latter, my colleagues use the former). On linux I've had little problem. I also tend to use `~ compile` in SBT. This will re-compile any time a file is modified, and notify you when an error occurs, so typically my code has already compiled by the time I actually want to run it. That's a really nice feature I wish I had in Haskell.
The more Scala code I write, the more readable the Scala code of others becomes. I don't think that Scala is intrinsically any less grokkable than historically-mainstream languages, it's simply that most devs have not been exposed to FP in any significant way (that describes me) and it takes some time to get your head around it.
It always strikes me that the IDE/tools complaints have a high degree of FUD-spread to them. I've had good luck with both Intellij+Scala plugin and with the Eclipse plugin. And yes, my code is in production and is substantially more complicated than "hello world".
I -love- SBT and I detest the XML-hell at the heart of Maven projects. As you say, to each their own.
Scala is a gateway drug to FP, which, given my newly-acquired prejudices is a good thing. But that said, you still have the vast universe of Java libraries at your disposal, and if you really want to, you can use Scala in an imperative fashion and still get a Java-with-fewer-warts experience. I've not been following the Java 8 roadmap very closely, but with each new release the language seems to get more complicated and uglier, with patch upon patch, a list of which, if stacked end-to-end, would stretch from Chicago to New York and would fill three Library of Congresses and many other Standard Metaphors. It's been a joy to work with a language without all that legacy rolled into it.
You're right about the compiler, though for me it's not a huge issue. My builds take a minute or two, not tens of minutes. You're also right about the docs being weak at this time. There are definitely trade-offs either way in the Java vs Scala decision. For my purposes and my skillset, Scala is a sweet spot with Python a close second.
Intellij Idea + Maven seemed pretty good, last time I had to write production Scala. I couldn't get it working with the fast background compiler daemon, which would have really helped.
I mainly used the Intellij scala plugin... It's code completion was incomplete and it identified syntax and type errors that weren't errors. This was on the latest intellij with the latest plugin.
I've been using Go recently and it's pretty good, but the main problem is the lack of generics. If you use a lot of generic code in Java, you're going to really miss it in Go.
> If you use a lot of generic code in Java, you're going to really miss it in Go.
Doubt it, Go code has much less need for generics than Java code. This is in part because of Go's interfaces which cover some of the same space, because Go has builtin map and slice types, and because the general coding style in Go.
Have you really felt the need for generics when writing Go code? Because that is very, very rarely the case for me, and talking with many other Go programmers, the need for generics seems to very rarely come up when actually writing real world Go code.
One has to realize that features are not interchangeable across languages, just because they are essential to some language doesn't mean that they even make sense in another language.
I run into most issues when implementing datatypes like stacks/queues etc
It would be so much more beneficial to write one stack struct with associated methods rather than having to duplicate functionality for each type.
It's possible to use empty interfaces, but then you have to do runtime type assertions which defeats the point of static typing.
Maybe I've just been spoiled by Haskell/Java in that side of things, but I really feel that compile time static typing solves A LOT of development problems
When I look at benchmarks of languages (notably this [1]), and compare Java to say Ruby or Python, it's about 40 times faster, and compare pretty well versus C++. And I'd rather code something in Java than in C++ everyday, all the time.
Now I'm not versed in the benchmarking of languages, and I don't care that much about them as I understand that they are not very reliable. But when I need a lil'more performance than Python or Ruby, but that I don't want to ruin my psychological balance with C++, I'm quite happy to have Java.
Maybe it's just my lack of knowledge that gets me to have this opinion. Maybe once I get a chance to try out Go and Scala, I'll find there is no reason to use Java anymore. But I don't think I'll get to the opinion that is it terrible and that it deserves to be hated and laughed at.
[1] http://shootout.alioth.debian.org/u32/which-programming-lang...
[Edit1] weakly -> dynamically