This month we created REST service as a project. Technical requirements were to use Hapi.js architecture [http://hapijs.com] to implement a solution. It’s a better alternative for well-known express framework. The problem with express is its simplicity in design. One of the goals of its authors was to make it as simple as possible. But in real life it’s not a criteria. You have to spend a lot of time to configure all components you need for your application. E.g., getting raw HTTP request content needs particular middleware attached into some point of HTTP request/response chain. That’s why a lot of teams and projects choose something more robust. Hapi provides very good balance between simplicity and power.
Beyond express framework
Hapi was created by Walmart software development team to hold under control their black-friday storm. By the way, this fact shows us one more time that node.js platform has both high performance and robust Application Development approaches.
A lot of cool technologies are coming from non-web world to Web Application Development. One of the most excited examples is WebGL [https://www.khronos.org/webgl/]. It’s a free web standard to use low-level 3D graphics right on the page via canvas element. It’s based on OpenGL ES 2.0 and has similar development approaches. To test if your web browser supports WebGL just go to http://get.webgl.org/. Almost all modern browsers and platforms support WebGL. It doesn’t need special plugin like Flash player or Unity.
Platform and features
First of all, GASP supports all major web browser including even old versions (keep in mind IE as the main troublemaker) deprecated by other animation libraries. Such safe configuration is very important in professional Application Development at line of client satisfaction.
Vim [http://www.openvim.com/] is a successor of the ancient vi text editor, which was created as primary UNIX visual text editor several decades ago when computers were really big and expensive. Despite such a great age, Vim is still a very popular and useful tool in Software Application Development and DevOps. Both console and GUI versions are available for all operating systems and platforms. It’s included into any standard installation set of Linux/UNIX family system. Because of its plain nature, our programmers can use Vim as both regular text editor installed and runned locally and opened in remote shell via Internet with effective workflow even in case of slow network connection.
In brief, Vim has 2 main modes: to navigate a cursor throw the text and to enter the text into place marked by the cursor. This would be the most terrible barrier between you and Vim. Don’t fight it. Just accept this approach and move on.
From plain static to LAMP and back to static
A lot of years ago CERN engineers invent Word Wide Web technology as a linked set of plain text documents with links to each other and special formatting for visualization. Ancient Content Management was just an editing of static files on the disk. Times changed. We passed several huge revolutions in Web Development and Content Management. LAMP stack and its similar analogies based on other platforms were like standard for decades. We hold data and other content in relation database with SQL interface to access it. The pages have been treated as HTML content generated dynamically on server side by some engine implemented in a programming language with appropriate library or framework. All parts of this scheme have been re-designed or re-invented from time to time. Some of them even several times. There was a lot of hype about Web 2.0. For making development process more robust and performance of solution better, we started to use solution appropriate for specific task or project, e.g., MongoDB instead of MySQL, MVC instead of mess of code. One of such method is to present web site as a set of pure static web pages without any dynamic logic on server side, absolutely.
Generate static content offline
Main idea of such approach is to have a project with sources like data, html templates or includable parts and containers to wrap all those elements together and configure navigation between pages. On another hand, we need a tool or even several utilities to build the project into destination representation of static web site. First time, our team experienced such technology in the Fitness project for very famous Top 50 public Web Portal 10 years ago.
Nowadays, nobody code raw CSS3 in real-world HTML5 Applications Development. Huge amount of monotonic repeated code is too hard to create and support. Usually, one of CSS preprocessors are used to implement CSS3 styles in more elegant way. LESS [http://lesscss.org/] is one of such approaches. It doesn’t need to spend a lot of time to start using it. Try online tool [http://lesscss.org/less-preview] to process LESS into CSS code.
First of all, LESS is pre-processor of special syntax into CSS code. Besides, CSS code is a correct LESS code as well. You can start porting your existing pure CCS3 project into LESS just by a copy-paste action. When we mark some section or module with specified CSS class we are going to format and style not just wrapper but all its inside components as well. LESS helps us in this most used case by its nested syntax. E.g., LESS code:
Every modern software development stack has one or more well-known common libraries which is not a part of the language core. On the other hand, such general purpose package extends standard set of methods and data structures to professional level of software development. E.g., STL for C++ world. Apache Commons [https://commons.apache.org] is one of the most useful set of general libraries in Java Development. A lot of other packages and frameworks are based on them. In case of new project, Iflexion developers, first of all, to look at Guava [https://code.google.com/p/guava-libraries] — a modern professional implementation of common methods.
Guava is done by Google, freely distributed and supported by Internet giant. They even claim Guava usage in their own projects as a standard. There are 3 main programming languages are used in Google: Java, C++ and Python. Guava is based on Java 6. That makes it useful in legacy projects implemented in terms of Java 6 and needed to support this version. E.g., strings join may be done in Java 8 as String.join(“, “, strings) or by Guava Joiner.on(“, “).join(strings). Guava modules are created with design patterns in mind. There are builders, factory methods, adapters, etc. Guava available via maven/gradle. E.g., for gradle:
Callbacks and other approaches
The simplest native way to deal with asynchronous code is to use callbacks. It may be ok in case of small application or use case. On the other hand, in real life Application Development, Iflexion company have complicated huge solutions splitted into many modules and layers. To use pure callbacks in this situation is antipattern.
ES6 new features