5 ms·
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.
- taligent 14y agoI would definitely go with Play. It is by far the best Java framework around for getting something done quickly and skips the design pattern/XML heavy approaches used in most of the other frameworks. And coming from a Rail background its convention over configuration approach is going to be more akin to what you are used to. The 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 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 http://news.ycombinator.com/item?id=2390816
- noelwelsh 14y agoI agree with the recommendation for Play 2. It is simple framework that covers a lot of bases adequately. If you want to do the HTML/database thing Play will cover this. If you want to do the REST service thing, Play will also handle that. If you just want to do REST services we've had a lot of success with BlueEyes (https://github.com/jdegoes/blueeyes https://github.com/jdegoes/blueeyes) and the framework we've built on top of this, Bigtop (https://github.com/bigtop/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 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.
- brutuscat 14y agoIf Play is truly code oriented I will definitely check it out. I hate those java projects where almost everything is xml, is unreadable and most of the times the examples don't even work... Thanks!
- nuriaion 14y agoIf both Java and Scala is new to you i would suggest to start with Scala and learn to read Java by the way. 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.
- bartonfink 14y agoI've used Play 2 for freelance work and I use Play 1.4 for my day job, and I vastly prefer Play 1.4. Play 2 is heavily biased towards Scala and static compilation (even to the point of requiring "HTML" templates to be compiled), and I don't see a substantial benefit to the Play 2 claim that everything - code, configuration, templates - is typesafe. 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.
- Mikera 14y agoFirst off, 48h is a tough call - the JVM is a huge ecosystem! You might want to moderate your expectations. Personal suggestions would be: - Get one of the major open source IDEs. I personally recommend Eclipse (http://www.eclipse.org/ 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/ 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/ 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.
- mindcrime 14y agoIf you're coming from a Ruby background, then JRuby might be your best bet. I'm not 100% sure where JRuby stands performance-wise these days, but - IIRC - they've been at the forefront of taking advantage of some of the new JDK7 stuff to improve performance. 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.
- hugofirth 14y ago+1. Second the comment that if you only have 48 hours then I would recommend having a look at doing something with JRuby. Torquebox.org is a modified version of the JBoss Application server built for JRuby I believe.
- rurounijones 14y agoAnother +1 with a slight addition. 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.
- brutuscat 14y ago+1 Agree. Java <-> Ruby interop opens your Rubyist head to many Java libs. Right now I'm prototyping some stuff and I need an FTP server so I'm running Apache Mina FTP server right from ruby. Pretty cool!
- gojomo 14y agoComing from Ruby and Node.JS, you may want to start with the new 'Vert.x' project from VMWare: http://vertx.io 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.
- rabbitfang 14y agoI'd look at Play framework V2 + Scala http://www.playframework.org/ http://www.playframework.org/ and Vert.x http://vertxproject.wordpress.com/ http://vertxproject.wordpress.com/ (Scala support coming soon). Since you already know Ruby you may consider using JRuby or Groovy with Vert.x as other options. Scala and Java are more efficient though. A good list of books for learning Play and Scala: http://capecoder.wordpress.com/2012/05/06/scala-books-being-published-at-quite-a-rate/ 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 http://www.jetbrains.com/idea/free_java_ide.html
- lgieron 14y agoIMO the recent version of Eclipse's Scala plugin is much better - IntelliJ's automatic error highlighting was nightmarish last time I checked (repeteadly highlighted correct code) and it's just too much of a distraction to bear.
- johnx123-up 14y agoJava Play or Vert.x. Play2 isn't really production ready http://news.ycombinator.com/item?id=3959877 http://news.ycombinator.com/item?id=3959877
- rabbitfang 14y agoPlay2 is released for production use and works with both Java and Scala. You've linked to an article which says essentially nothing. 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-final-is-released/ http://vertxproject.wordpress.com/2012/05/09/vert-x-1-0-fina...
- ExpiredLink 14y agoAsk HN: How to get productive as a surgeon in 48h? 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.
- thibaut_barrere 14y agoI think the OP is already a surgeon, only looking for advice before getting a new scalpel.
- atto 14y agoWe recently started migrating many of our systems from old (poorly coded) ColdFusion IIS servers to Play2 with Scala. My Java experience before was academic only and uptime/concurrency are big deals for us (payment processing), so we decided to give Scala a try. I have absolutely loved it. Play is a very strong framework, and Scala has greatly increased my abilities as a programmer.
- ippisl 14y agoGroovy is a great scripting language for the JVM, pretty easy and powerfull,supports optional typing, and has java like integration with the jvm. 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.
- pudakai 14y agoMay not be to everyone's taste, but it is at least worth mentioning Spring Roo. There is an integrated eclipse based IDE (STS) available as well. 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.