Author: Bilgesu Naz GÜVENDİK, SW Engineer – Web Development – Corporate Applications Group
The phrase “Real Time Web Applications” is in our life for a while. Even though people don’t recognize the term, they are probably using these applications in their daily life. There are different criteria and definitions, however it can be simply defined as “a web application which enable users to receive information as soon as it is published by its authors” (1). Facebook and Twitter are the first applications comes to mind.
There are a number of frameworks that supports real time web application development, with web sockets and Event Source features however we will only analyze and compare two of them due to their popularity and asynchronous non-blocking nature: Play Framework and Node.js.
Play Framework, defined as “a stateless, lightweight and developer friendly web framework” (2). It runs on the JVM, developed in Scala and it supports both Java and Scala languages.
Both of these frameworks are capable of handling asynchronous I/O and scalable. They are used for high concurrency. They both support real time operations with WebSockets and EventSource. They are supporting RESTful web services. They have both their own package management systems and many packages / modules for different functionalities.
All these similarities aside, we need to consider differences before choosing one for a project.
Learning Curve & Materials
Learning a new framework can take a while if the developer has no experience with similar technologies but it also depends on the experience of the developer.
Play Framework has a very active developer community. It has a detailed documentation and many starter templates both in Scala & Java with different technological stacks in its website. However many said that they are not simple enough for beginner level.
It seems like Node.js has an advantage on starter materials, but when it comes to a real application, it is getting more difficult to find a solid example of how a complete web application should be in Node.js.
Play, however, has a clear MVC architecture and guides developers in a certain architectural design.
Starting the Project
Frameworks built on top of Node.js, mostly covers very little core functionality. Node.js ecosystem has Npm as package manager. Finding and configuration of the suitable package left to developers.
Play Framework, supports convention over configuration (5). Most of required modules to write a complete application comes with the initial setup, thus allows developers to start coding immediately instead of dealing with configurations. If the default modules are not enough, needed modules can be easily included with package manager SBT. It can also download Maven packages.
Using Real Time & Non-Blocking I/O Features
Both frameworks supports real time web applications as mentioned before. However they use different approaches.
Node.js has an event driven architecture. Developer can easily fall in the callback hell which makes it very hard to read or debug asynchronous code. Therefore there are supporter packages to control event flow.
Play Framework also supports non-blocking I/O. It is built on Akka Streams. With Akka (6) and future / promise support, Play has different solutions for highly concurrent applications.
Which Framework is Suitable for My Project?
 Real Time Web, https://en.wikipedia.org/wiki/Real-time_web
 Play Framework Official Web Page, https://www.playframework.com/
 js Official Web Page, https://nodejs.org/
 NodeSchool, nodeschool.io
 Convention over Configuration, https://en.wikipedia.org/wiki/Convention_over_configuration
 Akka Official Web Page, http://akka.io/