Ask HN: How to get productive with the JVM in 48h?
For a new web app with heavy IO, Websocket support and high performance requirements I am looking for a new framework.
Coming from Rails and Node I want to try the JVM.
How should I start to get quickly productive:
- JVM with Java?
- JVM with Java/Play?
- JVM with Scala?
- JVM with Clojure?
I know that my question is a bit broad and usually you should start your project just in the preferred language and when scaling gets a problem you can always switch to something else like the JVM.
But let's just assume I just want to use the JVM—what's the quickest way to get into it? Give me hints, resources and experiences. Thanks.
20 comments
[ 3.2 ms ] story [ 54.5 ms ] threadThe real issue is how heavy your I/O is going to be. Play2 is very new but is designed for your use case as it incorporates Akka. Play1 however is easier to use and more well understood. For me I would start with Play2/Java and then selectively incorporate Scala where you need to. That's just because I find Java dead easy to code, maintain and hire developers for.
Twitter has some great open source libraries/resources for Scala at http://twitter.github.com that can help.
Also if you have full control of your stack do look at Nginx/Lua. It is lightening fast. http://news.ycombinator.com/item?id=2390816
If you just want to do REST services we've had a lot of success with BlueEyes (https://github.com/jdegoes/blueeyes) and the framework we've built on top of this, Bigtop (https://github.com/bigtop/bigtop). Documentation is lacking compared to Play. It's an option is you're feeling braver, want to do pure REST services, and want more performance than Play gives you.
I think only crazy people use Java. It's just not productive enough. I use Scala. The shape of the learning curve will depend on your experience with modern languages. If you've done Ruby/JS and are happy with blocks/closures and stuff like underscore.js you're halfway there. If you've ever done any Haskell/O'Caml/ML you're 90% of the way there.
Getting started on the JVM can be daunting. In the Scala world we use SBT (https://github.com/harrah/xsbt/wiki) which gets around a lot of Java/Maven nonsense, though adds some of its own. Other languages will have their own build tools.
I've had a tiny peek at VertX, and don't like it. It seems to encourage callback spaghetti and doesn't seem to make good use of the type system.
If you go any of the Scala options above feel free to drop me an email (in my profile) if you need help.
I came from a background of a lot of Embedded C and some Ruby. For me Java had more a feeling like C. Very clumsy and needs a big amount of code to describe something.
I'm perfectly willing to accept the possibility that I just don't get it, but I think Play 1.4 provides a far better development experience. Further, there's no sign that the developers are going to abandon the "old" Java-centric Play architecture anytime soon, so you won't be starting out on something with a shelf-life measured in weeks if you went that route.
Personal suggestions would be:
- Get one of the major open source IDEs. I personally recommend Eclipse (http://www.eclipse.org/)
- Learn some Java first. Since it's the Ligua France on the JVM, you'll want to know it if only so you can read code. If you like your more modern languages you can always switch to Scala/Clojure later once you are familiar with the Java ecosystem.
- Play (http://www.playframework.org/) is a great framework for your web app. Give it a try.
- Netty is a great IO framework (http://netty.io/). If you really care about IO performance, you will probably want to use Netty (or something based on Netty). I've used Netty for low-latency game servers, for example.
Short of that, Play does have a really good reputation in the Java world, but I haven't used it personally, so I can't share any first-hand experience. Still, what I've heard has been pretty positive.
Torquebox (2.x) is JBoss AS7 with extra ruby inter-op code layered on top of it. The base JBoss is not modified significantly.
You can happily run Java apps on Torquebox alongside JRuby apps (and clojure apps if you want with the immutant project)
There are reports from people on the mailing list of using JRuby and Torquebox for the back-end data collection services used by AAA Games which process a he-uge number of requests per month.
http://vertx.io
It's very new – not sure if yu'll find much community/testimonials – but since it supports (among other languages) Ruby and JS, uses the Netty framework, and opens the world of other Java libraries to your project, it might offer you the shortest-path to watching a JVM run your ideas under load.
A good list of books for learning Play and Scala: http://capecoder.wordpress.com/2012/05/06/scala-books-being-...
IntelliJ + Scala plugin is widely regarded as the best IDE for Scala work: http://www.jetbrains.com/idea/free_java_ide.html
You're suggesting that Vert.x is more production ready when it was only released 3 days ago? http://vertxproject.wordpress.com/2012/05/09/vert-x-1-0-fina...
Coming from cooking I have professional experience in chopping meant and I assume to be shortly up and running in my new professional field. I'd appreciate any links to tutorials (like 'Surgery for dummies') and sellers where I can cheaply buy scalpels and other tools needed. Thanks.
Groovy++ is a statically typed extension to groovy that add type inference , and let's you have java like performance for groovy, by doing little more work.
vert.x supports groovy, play supports groovy and play's template engine uses groovy.
You can get a nominal Java CRUD app up in short time with this.
I had been out of Java for a number of years, but we wanted to start w/jvm back end. I was surprised at how much of Spring complexity it encapsulates, it has worked quite well for us so far, although we are still very early on in the process.