My last post on Play vs Nodejs got a lot of traffic in the last 10 days, but it also opened a number of conversations. Here are the key comments.
Did Nodejs beat Java?
No way. As my post got retweeted, it was cast as Java winning on V8/Nodejs. That’s not the case. I have no data to make such a claim. Java has its strengths as well as legacy baggage to carry along with it. It would be irresponsible on my part to make such claims based on such a such a test, and I was clear about the conclusions I drew in my post.
Is Groovy the culprit?
Play uses Groovy as the expression language in templates and hence may have impacted performance of the Play based app. However, given that it was a design choice made by the Play framework to use Groovy for expressions in its out-of-the-box template engine, I think it is fair to use Play’s default template engine for testing.
How about alternative templates?
Japid claims to be 2-20 times faster than Play’s bult in template engine. But I found several issues with Japid:
- It is non-intuitive to use. The syntax is a bit arcane to my taste.
- I did not like the template engine throwing exceptions about the generated Java source and not the HTML view. For a template engine to build HTML, HTML should be the basis for error reporting.
- I managed to prevent the server from starting and it was not trivial to find out what caused the problem.
Of course, these are subjective statements, and you may have a different take on Japid. These are also fixable, and as Japid evolves, I’m sure some of these will go away.
I really wanted Mustache to do well, but however, it did not pass my two-hour test. I was unable to get it up and running in about two hours. I had prior experience with Mustache, but in this particular case, Mustache required some changes to the shape of the JSON data coming from the backend. This app requires some additional mutations to the data before rendering, and Play’s Java extensions made it trivial, but not Mustache. But this is fixable.
In the end, if I were to pick a Java stack for front-end development, I would go with Play over other Java alternatives.