55

I am really torn between two different stacks with which to build a large application. One the one hand there is this option:

  • Node.js
    • express
    • coffee script
    • coffeekup
    • mongoose/mongodb or
    • presistencejs/mysql


  • Play Framework w/ Scala
    • Anorm w/ mysql
    • or mongodb

The node.js path is appealing to me because i can write all of the server side code, views and client side code in coffeescript, which i already know. If i go down this road i am still not 100% sure which db path i would take. mongoose makes storing data quick and easy, but the lack of true relationships might be more difficult to work with given the data model i have in mind (very SQLish).

The Play Framework path is also appealing because i know the framework well when using Java, but i don't know much about Scala, so there would be a hit to productivity as i work through learning that language. The Anorm database access layer is appealing because i can write the SQL by hand which i would prefer, and have the results mapped to objects automatically, which saves a lot of effort.

I keep leaning towards node.js, but i'm not sold on the best db access layer to use. Anyone have any experience with any of this and can share some insight?

Jason Miesionczek
  • 13,718
  • 14
  • 73
  • 108

2 Answers2

47

The stack you choose should depend upon the needs of your application. Let's look at Play vs. Node for their strengths:

Node

  • Real-time applications (chat, feeds)
  • Event-driven architecture
  • Can perform client-server duties (e.g. serve files), but not well-suited for this
  • Database management, testing tools, etc, available as additional packages

Play!

  • Client-server applications (website, services)
  • Share-nothing architecture
  • Can perform real-time duties (e.g. Websockets), but not well-suited for this
  • Database management (including migrations!), testing tools, etc, built into core

If your application more closely matches a traditional web-based model, Play is probably your best choice. If you need immediate feedback and real-time dynamic messaging, Node is the better choice.

For large traditional applications, seriously consider the Play! Framework because of the built-in unit and functional testing along with database migrations. If incorporated into the development process, these go a long way toward an end product that works as expected and is stable and error-free.

Mike
  • 1,597
  • 13
  • 14
  • 33
    Can you explain why Play Framework is not well-suited for real-time duties? Play Framework is based on an event-driven server architecture. – Jonas Nov 06 '11 at 21:02
  • 2
    Play Framework is built on a client-request server architecture. It's possible to do asynchronous operations using continuations and Play Framework has libraries for making this easier; its strength is in short request life cycles (i.e. traditional web requests) http://www.playframework.org/documentation/1.2.3/asynchronous – Mike Nov 07 '11 at 00:56
  • 30
    I think Play 2.0, however, is well suited for real time duties -- here're some [Play 2 WebSocket examples/docs](https://github.com/playframework/Play20/wiki/ScalaWebSockets). – KajMagnus Feb 19 '12 at 07:43
  • 2
    If you doubt it, checkout the [Typesafe console](http://console-demo.typesafe.com/). Real-time dashboard. – i.am.michiel Mar 22 '12 at 17:49
  • 1
    KajMagnus' link no longer points to a valid example. Here are the docs about websockets in Play 2.3.3 however: https://www.playframework.com/documentation/2.3.3/ScalaWebSockets – Nepoxx Oct 15 '14 at 15:52
13

There are 10 major categories you should consider when comparing web frameworks:

  1. Learn: getting started, ramp up, overall learning curve.
  2. Develop: routing, templates, i18n, forms, json, xml, data store access, real time web.
  3. Test: unit tests, functional tests, integration tests, test coverage.
  4. Secure: CSRF, XSS, code injection, headers, authentication, security advisories.
  5. Build: compile, run tests, preprocess static content (sass/less/CoffeScript), package.
  6. Deploy: hosting, monitoring, configuration.
  7. Debug: step by step debugger, profilers, logging,
  8. Scale: throughput, latency, concurrency.
  9. Maintain: code reuse, stability, maturity, type safety, IDEs.
  10. Share: open source activity, mailing lists, popularity, plugins, commercial support, jobs.

Check out my talk Node.js vs Play Framework for a detailed breakdown of how these two frameworks compare across these 10 dimensions.

Yevgeniy Brikman
  • 7,399
  • 4
  • 38
  • 55
  • 2
    That was definitely a great talk, but I was a bit surprised that you did not mention that Play is fully usable with Java, I feel like it can increase its appeal to a lot of people. – Nepoxx Oct 15 '14 at 17:09
  • 1
    @Nepoxx: The talk was at a Scala conference, so I focused on Play/Scala, but as you said, Play can be used with Java as well. – Yevgeniy Brikman Oct 31 '14 at 05:33