A Brief Comparison between Real Time Web Frameworks for Beginners

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.

Node.js, on the other hand, actually not a web framework. It is a “JavaScript runtime built on Chrome’s V8 JavaScript engine” (3). There are a lot of web frameworks developed around it. To keep things clear, I will refer all these frameworks as Node.js in this post.

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.

Many teams choosing Node.js for their projects only because of the developer team has some experience with JavaScript and they assume learning server side architecture will be smooth for those front end developers. Also there are many resources about Node.js that helps learning process. NodeSchool (4) has even interactive lessons about all core packages. Many blog post describes “how to?” in simple forms.

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.

Development Productivity

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?

With all the points mentioned above, there is no golden match suitable for every team or project. Choosing the right technical stack for project both depends on requirements and also efficiency of the development team. If the team is already experienced with JavaScript environment and the project is not planned as a large application, Node.js can be suitable. However, if the project is planned as a long term application and needs to have a solid safe code base, Play Framework would be the right choice.

References:
[1] Real Time Web, https://en.wikipedia.org/wiki/Real-time_web
[2] Play Framework Official Web Page, https://www.playframework.com/
[3] js Official Web Page, https://nodejs.org/
[4] NodeSchool, nodeschool.io
[5] Convention over Configuration, https://en.wikipedia.org/wiki/Convention_over_configuration
[6] Akka Official Web Page, http://akka.io/

 

 

Leave a Reply

Your email address will not be published.