7 ms·
This submission's title is horribly misleading because Play is not a Scala web framework. It's a web framework for Java and Scala. As someone who's used Play h
by benmccann 11y ago
This submission's title is horribly misleading because Play is not a Scala web framework. It's a web framework for Java and Scala.
As someone who's used Play heavily for the past couple of years, I'm very excited by this release, which is Play's best yet.
- rmsaksida 11y agoDo you use Play with Java? I always thought Play looked incredible, but the focus on Scala puts me off. Every time I tried it, Java seemed like a second-class citizen in the Play world. I don't have anything against Scala, I'm just not really interested in learning it, especially if I all I want to do is use a web framework.
- redtuesday 11y agoIt seems that the Java support got much better since the initial release of play 2, and it is planned to get it on equal footing with version 3.0 which seems to be the next release after 2.5. EDIT: never used the Java side myself, though. EDIT2: here is a nice comment on Java vs Scala: https://groups.google.com/forum/?nomobile=true#!searchin/play-framework/Java%7Csort:date/play-framework/RN-Ho2L8atU/fQtAP7HorKEJ https://groups.google.com/forum/?nomobile=true#!searchin/pla...
- eloisant 11y agoI've used Play with Java, helped a customer (a big insurance company) move all their developments to Play Java. It works fine. The only annoying thing is the asynchrone nature forces you to have abstract classes everywhere, but with Java 8 it's no longer a problem.
- robmcm 11y ago> the asynchrone nature forces you to have abstract classes everywhere Could you elaborate?
- benmccann 11y agoAsynchronous code is often more performant, but requires you to supply a callback if you want to take further action after the async code completes. In Java, this typically means subclassing Callable or some other class and you end up with lots of anonymous subclasses, which can be quite verbose. Java 8 introduced new syntax by allowing lambdas which removed the verbosity. Play 2.4 uses Java 8 and some of its examples shrank quite a bit in terms of lines of code.
- zzalpha 11y agoI think he/she meant anonymous classes, not abstract. Akka uses callbacks to handle asynchronous behaviours, which means you need closures, and in Java <8, that means anonymous classes littering your code, which is a real PITA.
- robmcm 11y agoOh yeah, that makes more sense.
- colund 11y agoThe Java 8 syntax improvement is actually shown a bit down the page https://www.playframework.com/documentation/2.4.x/Highlights24#Java-8-support https://www.playframework.com/documentation/2.4.x/Highlights...
- kodablah 11y agoI find that while it works, it is a bit cumbersome. I also find this with Java API's in Akka, Spark, Kafka, etc. Having said that, I absolutely love Scala and I think you should learn it anyways (as with any language you can, even if it's only minimal).
- benmccann 11y agoYes, I use Play exclusively with Java. I've never felt that Java is a second-class citizen with Play. All the features are supported from both languages and the core developers are very eager to ensure that you can work equally well with both languages. I'm not entirely sure why Play has a reputation of being for Scala except that there are fewer web frameworks for Scala than Java, so Play is more popular among Scala developers. I think the other thing that confuses newcomers is that the templates are Twirl templates. They should probably have an extension like .twirl but unfortunately use the extension .scala.html even though you're really not writing Scala at all. You're writing Twirl which is it's own thing and doesn't take more than a few minutes to pick up. (The reason for the .scala.html is that templates get compiled to Scala, but you really don't have to know or care about that)
- ramkalari 11y agoI have built a couple of apps running Play on Java and I like it. I still prefer Rails if the customer is starting on a clean slate but Play Java has worked out pretty well.
- sctb 11y agoThanks, we updated the title to that of the article.
- acjohnson55 11y agoGreat point, my bad!