How to hybrid Mysql and MongoDB in Play framework?

Node.js + Express or Play Framework?

  • I'm about to create a startup to develop a web/mobile project which can became quite large in the future. I've been studying the tech stack to use which better fits my needs in terms of: productivity, maturity, performance, robustness, scaling, testing, ecosystem. I'am in doubt between Node.js and play framework, they both have event servers with non blocking I/O and i think they can both scale to hundred of connections. Real-time is not a priority, i guess Node.js shines on that but Play as good support for webscokets too. The persistence layer will probably be a NoSql solution MongoDB ou CouchDB, again Node.js as support for MongoDB i don't know how goos it is, also Play have their own layer to communicate wit NoSQL databases as far as i know. I think play beats NODE.js + Express in productivity, maturity, testing and ecosystem. Don't know about performance i guess its similar, scaling and robustness i don't know. I guess Play Framework offers a greater set of "classes" providing things like: form validation, REST web services, security, user sessions, routes, mvc, etc, that express.js doesn't offer, correct me if i'm wrong here. Also to use Node.js i'll have to depend on external libraries like express.js or connect, http://socket.io or sock.js, libraries to talk with mongo, and i don't know what will happen to these libraries in a mid/long future. Im inclined to choose Play Framework, LinkedIn guys are using it to back some of their services and for what i've seen Node.js normally comes into play to provide real-time features like chats or collaboration apps, push notifications and not used like a full web stack service, LinkedIn also uses it to back up mobile services but i don't know how, probably with the help of some queue like RabbitMQ to do the work. If anyone with more experience with this tools can provide me better explanation i appreciate. PS: I'm not alone on this, 3/4 guys working in a team. Sorry for the long post.

  • Answer:

    In my view, this depends heavily on what it is your building. If it amounts to a web site with a bit of interactivity, you could build that with something like express.js, but that's not the best use of node.js. If you're building a single page application, however, then we can talk. There are two needs of a single page application: Deliver the application to the web browser Service that application through some sort of ajax based API. In both these cases, node.js shines. When both the web server and the client speak the same language, there are no translation issues with the data. And they can both share code, like validation, keeping things DRY. Also, the model of getting in, grabbing some data, doing some light processing on it, and sending it back to the browser is exactly what asynchronicity is good for. Node is built from the ground-up to be asynchronous, it's just the way JavaScript works. Every library you will ever find for node will be asynchronous. You cannot say the same thing for either Java or Scala. MongoDb and Redis are pretty much the de facto data stores for node.js. You will find no shortage of support for it. All development relies on external libraries. In Ruby you have gems, in node.js you have modules. Even the Play framework itself is a third party library. Node.js has a very active community, with all sorts of modules. Many of these, for example express, are so popular, they won't be going anyplace any time soon. And keep this in mind, regardless of your backend, you will be using JavaScript, it is your only choice on the frontend. Keeping both the backend and frontend in the same language will reduce context switches. And that saves money.

Glenn Anderson at Quora Visit the source

Was this solution helpful to you?

Other answers

Whoever asked this question, I suggest go with Play Framework. It's one of the revolutionary framework of current time. You won't regret at any point, trust me. Highly customizable and scalable plus Typesafe guys are extremely supportive with any information. Typesafe just rocks!

Piyush Chauhan

There are 10 major categories you should consider when comparing web frameworks: Learn: getting started, ramp up, overall learning curve. Develop: routing, templates, i18n, forms, json, xml, data store access, real time web. Test: unit tests, functional tests, integration tests, test coverage. Secure: CSRF, XSS, code injection, headers, authentication, security advisories. Build: compile, run tests, preprocess static content (sass/less/CoffeScript), package. Deploy: hosting, monitoring, configuration. Debug: step by step debugger, profilers, logging, Scale: throughput, latency, concurrency. Maintain: code reuse, stability, maturity, type safety, IDEs. Share: open source activity, mailing lists, popularity, plugins, commercial support, jobs. Check out my talk http://brikis98.blogspot.com/2014/09/nodejs-vs-play-framework.html for a detailed breakdown of how these two frameworks compare across these 10 dimensions.

Yevgeniy Brikman

One of the most important benefits you’ll get by using Node.js is being able to iterate rapidly. I recently had the chance to talk with Jeff Harrell, engineering manager at PayPal and then number one reason why they migrated all PayPal’s apps from Java to Node was rapid iteration. “Our new approach was all about rapid iteration. We wanted to be able to experiment and bring those experiences to our customers as fast as possible. Neither the C++ or Java stacks were built for this, both having large build times for even the smallest changes. Node was one of the many environments out there which catered to this type of fast development.” The same idea is supported by Dan Pupius, lead engineer at Medium who says that it made everything much easier to implement features end-to-end. “It was partly an optimization based on the early team at Medium and the people the company wanted to attract at the time. But it has made it much easier to implement features end-to-end and nicely facilitates sharing of client and server code. We have also benefitted a lot from the npm ecosystem and the community generated libraries.” If interested, here you can find the full interviews with http://www.talentbuddy.co/blog/building-with-node-js/ and http://www.talentbuddy.co/blog/on-building-with-node-js-at-medium-and-growing-as-a-developer/.

Vlad Berteanu

guess  you can use both scala and node.js where in node handles the I/O requests and scala does heavy computing in from the back end. Please correct me if this combination isn't right.

Ganesh Karthick

While both of these languages and frameworks can be used to write backends, this question is quite akin to comparing apples and oranges.Scala is a functional hybrid programming language running atop the JVM which has strong types (a turning complete type system), deep support for functional programming, and overall, more maturity compared to JavaScript. Play framework is a nice, fast developing framework that has support for Scala as well as Java and provides the basics of backend programming quite well. Scala comes packed with powerful tool sets like Akka, which can powerfully express the actor pattern. Having said that, Scala still has some rough edges but they aren't very hard to overcome. It is also known for having a steep learning curve, which is mostly because functional programming is a paradigm shift.JavaScript, on the other hand, is a weakly typed, confused programming language that makes large projects nightmarish to maintain. Just because as a programming language, JavaScript doesn't get the basics right, I'll stop there.This is my opinion. In my experience, I just don't like JavaScript on the backend. Not until the specs of the language improve.

Ashesh Ambasta

My answer will be if you know Scala/Java and Javascript then try a simple project in both frameworks and learn which one will serve you best, I've used both node.js(express.js) and scala(play framework) and the both have up's and down's, like in node you don't care much about types but you do in scala, meaning you can't just pass an object to a function an expect it to work; but if you do something in scala you believe is right cause the compiler will tell you otherwise if it was not so.

Felix Boamah

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.