NodeJS vs Play Framework for large project
Asked Answered
W

2

54

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?

Washedup answered 3/10, 2011 at 19:32 Comment(0)
K
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.

Kynan answered 3/10, 2011 at 23:21 Comment(5)
Can you explain why Play Framework is not well-suited for real-time duties? Play Framework is based on an event-driven server architecture.Flatfish
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) playframework.org/documentation/1.2.3/asynchronousKynan
I think Play 2.0, however, is well suited for real time duties -- here're some Play 2 WebSocket examples/docs.Surfperch
If you doubt it, checkout the Typesafe console. Real-time dashboard.Starstarboard
KajMagnus' link no longer points to a valid example. Here are the docs about websockets in Play 2.3.3 however: playframework.com/documentation/2.3.3/ScalaWebSocketsOsteoclast
B
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.

Burkitt answered 29/9, 2014 at 19:1 Comment(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.Osteoclast
@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.Burkitt

© 2022 - 2024 — McMap. All rights reserved.