2016 is not going to bring substantial changes to software development. Attention is on optimizing existing options and increasing performance. Familiar names and programming languages are still on top. JavaScript with its growing popularity deserves to be highlighted.
Node.js
Node.js is a cross-platform freeware runtime designed to build network applications.
The reason for Node.js popularity is definitely the possibility of using JavaScript on the server side. That gave many developers the opportunity to develop server solutions that otherwise could have tangled into the lack of knowledge of necessary programming language.
Thanks to asynchronous programming language, Node.js application is much more efficient, since different actions can run simultaneously. One action doesn’t block the other, so there is no need to wait for the first action to finish.
Node.js is mainly used to create the following solutions, but definitely isn’t confined to these:
- API-s
- Web servers
- Mobile applications’ server-side interfaces
- Static content servers
Asynchronous modules significantly improve speed. It is also quite easy to create real-time applications using popular Socket.io motor.
In creating web servers, Express framework is very popular. We prefer it here at Redwall as well. For example, in order to start a very simple web server, only this code is needed:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
var server = app.listen(3000, function () {
var host = server.address().address;
var port = server.address().port;
console.log('Example app listening at http://%s:%s', host, port);
});
Given web server responds to juridical address (/) “Hello World!” and all the other inquiries 404 Not found. At the moment, the server created, doesn’t do anything particularly useful, but it shows how easy it is to create a new web server using Node.js and Express framework.
Here at Redwall, we’ve used Node.js to create mobile applications – namely to create API-s that offer necessary information to the application.
Cross-platform mobile applications (Apache Cordova)
Apache Cordova is a freeware mobile application framework running on NodeJS. It enables to develop applications that use popular HTML, CSS and JavaScript. A benefit of Apache Cordova framework is creating applications, using one codebase, to several platforms, for example iOS, Android, WP8 etc.
Cordova communicates with the actual device through plugins (when writing this, there were 845 of them), and in addition, many extensions that aren’t officially registered but are added to GitHub by developers. Plugins enable using device’s general information, camera, calendar, contacts, files, dialogues etc. If a desired extension doesn’t exist, one can always program it according to necessary platforms (but here the knowledge of correspondent programming language is necessary).
Cordova is increasingly being used to avoid developing from scratch when developing for several platforms. Because of this, Cordova’s success and popularity will grow in the coming year. Creating native-applications without the framework would require knowledge of Java for Android, Objective-C or Swift programming language for iOS, C++ for WP8. That would mean creating the application separately for every platform, plus having all those skills in the team. All this leads to time consuming work for the team and, therefore, a higher price for the client. Yes, it could be, that without the framework the application could run smoother, but when using well constructed HTML ja JS frameworks with Cordova, the result is very close, if not the same. The client often prefers lower price when the speed of application is almost unnoticeable.
PHP7
PHP is going through major changes, skipping releasing PHP version 6. The reason for skipping PHP 6 were several wrong decisions. Mainly regarding Unicode standard. In order to refrain from the bad reputation following PHP 6, they renamed the new version PHP 7. In reality, it probably caused more confusion than was avoided, but at least we know that problems, that would have come with PHP 6, are solved.
According to the plan, PHP 7 had to be released in December 2015. On the 3rd of December, it was.
PHP 7 created several interesting options:
- scalar type declarations
- return type declarations
- null coalesce operator
- group use declarations
- anonymous classes
Actually, there are so many more options, one better than the other. I just listed some more memorable to me. But the rest are definitely not less important.
An example of null coalesce operator.
<?php
// Tagastab 'nobody', kui $_GET['user'] väärtust ei eksisteeri.
$username = $_GET['user'] ?? 'nobody';
// See on sama, mis järgnev (< PHP 7):
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';
// Null liitumise operaator on aheldatav. Tagastab esimese defineeriud väärtuse
// $_GET['user'], $_POST['user'] ja 'nobody' hulgast.
$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody';
?>
PHP users know how much easier it makes determining a simple variable. Seems like a small change but eliminates writing inconvenient repetitions.
Speed and performance
PHP 7 is allegedly two times faster than its predecessor. New version is based on PHP Next-Gen project that was controlled by Zend in order to speed up applications that use PHP. And they’ve done an amazing job! The performance of actual applications is, depending on the application, 25% to 70% better. That is a huge win resulting from just updating PHP version.
PHP 7 is something we really looked forward to. Now it’s here and available in our computers and servers as well.
ECMAScript 6
ECMAScript 6 (also known as “ES.next” and “Harmony”, shortly ES6) got to the developers only in 2015. At first, the release goal for ES6 was 2013, but development, fixes and testing took much longer than predicted. So the release date was repeatedly postponed. ES6 was officially released and acknowledged as a standard on June 17th 2015.
Since, for obvious reasons, ES6 support couldn’t be applied to the browsers, it will definitely be done this year. At the moment, several options are in progress and incomplete. Firefox has, so far, done the best job in applying support, 85% (at the time of writing this article, in version 45 that has not been released officially). ES6 support development can be monitored here: http://kangax.github.io/compat-table/es6/. Based on this data, it could be concluded that implementing support will take the longest in Safari.
But of course, missing support will not keep developers from using the new standard. While browsers work on support, compilers like Babel and Traceur.
JavaScript isn’t just a client-side language anymore. Since it’s now used in back-end development as well, the transition is even more time-consuming. NodeJS is also step-by-step adding ES6 options and making good progress with it. Read about ES6 support: https://nodejs.org/en/docs/es6/. Options that aren’t stable yet, can be activated by using --harmony
flag.
So, 2016 will be a year of implementing a new standard. ES6 will go into masses and will become an everyday tool of JavaScript developers (if it hasn’t become one yet). There are many new possibilities that will simplify and speed up programming in JavaScript (classes, modules, promises, const etc).