By continuing to use this site you are agreeing to our use of cookies, as set out in our privacy policy.

« go back Tech comment

Angular thoughts

Article by Chris Sawyer Angular4.jpg

Got the hang of Angular 2 yet? Angular 4 was released in March and a new version will follow every six months thereafter. It’s not necessarily bad news though...

It’s not bad news as Google is rigidly sticking to the semantic versioning process. By upgrading the TypeScript dependency from v1.8 to v2.2, it forces a potentially breaking change to Angular applications – hence the major number version increase. For most apps, it’ll just be a recompile, but that’s not guaranteed.

Since then, the name has just been ‘Angular’ – no ‘.js’. Version number ‘3’ was skipped due to that already having been used on Angular Router and the development team wanted to unify the version number across all official libraries.

Youmightnotneedjquery.com

React.js from Facebook is one of the best and most popular HTML5 frameworks. It is being adopted by several banks as their strategic UI platform (at least for the foreseeable future – which is 2-3 years in HTML frameworks). Due to the way it uses a virtual Domain Object Model (DOM) to compare with and update against, it doesn't play very well with jQuery – which doesn’t give a stuff as to how you’re controlling your page, it’s going to update the DOM directly, so there. Hence, React can throw a strop when you do things behind its back.

It’s very easy to end up with a dependency on jQuery without realising as it’s used as the foundation to many third-party widget/CSS frameworks, such as Bootstrap. So don’t use it yourself unless you really need to and visit youmightnotneedjquery.com first. This elegant site shows how and what jQuery does and how it is possible to keep its functionality without using it directly.

TypeScript and Flow

TypeScript is the language of choice for Angular (2 onwards) development and TypeScript 2.X is a vast improvement of v1.X. TypeScript is not only a language that’s very similar to ES2015 JavaScript with strong typing, but also a transpiler, lexer and tool set to convert your TypeScript code to JavaScript 5. It’s really an all-or-nothing solution – you aren’t going to use it on just one file and you’ll need to version control the TypeScript, not the JavaScript.

Facebook’s Flow is slightly different; it just deals with the strong typing aspect. By attaching data types to objects and variables, you will save yourself from null exceptions and invalid assignments. It only works on files that are specified, so it can be adopted piecemeal. It works extremely well with React, requiring a BabelJS plugin. It’s not a compiler as such; unlike TypeScript, it doesn’t support new language features like Interfaces, it’s just a type checker so the Babel plugin just removes the types.

Both of these approaches are going to become more popular in financial enterprises – perhaps even mandatory as they greatly facilitate refactoring, code handover, confidence in the codebase and readability… things that banks crave.

FinJS

The FinJS conference in London in December 2016 was attended by the great and the good in web technologies and finance. A number of interesting points were made:

  • Node.js hasn’t made it into production in many, if any, financial services institutions yet.
  • Incumbent technologies have a long tail and can take a long time to replace.
  • No one feels as though they have the testing and tool set right.
  • Everyone wants to wrap the main frameworks to make life easier for themselves but this ties them down to several years on the same platform, which is tricky when JavaScript frameworks need to be re-evaluated every 2-3 years. They are reduced to adopting strategies and patterns for data transfer, API best practice, functional breakdowns etc, rather than frameworks.

Atom, Electron and Muon

Atom is a code editor/IDE that is written in JavaScript/HTML, but runs like a native application on most desktop operating systems. The Atom developers then released its framework as Electron. Thus it’s a suite of tools and libraries that allow the creation of standalone executable apps that run on Windows, Mac OS and Linux and look and behave as though they are native apps – despite being written in JavaScript/HTML and run on an embedded version of Node.js.

This sounds and works well up to a point, but financial institutions are unhappy with the security model – or lack thereof – in Electron. The Atom development team ripped out a lot of the security features that the banking industry loved in order to make development easier.

OpenFin has a framework based on Electron but with many finance friendly extensions. This is used by many of our clients. Brave is a great new browser that’s also based on Electron by Brendan Eich – the man that created JavaScript and Mozilla/FireFox. A GitHub fork of the Electron codebase is underway and this is going to be called ‘Muon’; a clever name as a muon is like an electron but heavier. This rewrite will remove some of Node’s involvement in the rendering process and allow for Chrome extensions, plus other goodies.