Reg comments12

Angular framework's grand ambition: Not breaking anything

Google's web app scaffolding seeks recognition as platform

Angular, the popular web application framework, reached version 4.0.0 last week, having skipped version 3 entirely.

Known for its role in the MEAN stack – MongoDB, ExpressJS, AngularJS, and Node.js – Angular lost the "JS" suffix and some of its momentum when version 2 appeared last year, largely because it was incompatible with the first release.

Dispensing with "JS" wasn't merely a change in branding. It reflected the fact that Angular 2.0 was written in TypeScript, a superset of JavaScript created by Microsoft that adds support for static typing.

Static typing – checking the type of data associated with a variable at compile time – can reduce type-related errors by making them apparent before the code gets run.

Though StackOverflow's 2017 Developer Survey puts AngularJS ahead of React, that may reflect the size of Angular's installed base more than current affinities. Given other metrics, such as GitHub stars, not to mention those voicing enthusiasm for React and Vue.js, Angular looks to have lost some ground against lighter weight alternatives.

But comparing Angular to React or Vue.js isn't entirely apt because Angular has loftier ambitions.

"We're very aware of what's going on in the ecosystem," said Stephen Fluin, developer advocate on Angular at Google, in a phone interview with The Register. "But we do have a different perspective."

Where React and Vue.js qualify as frameworks, said Fluin, "We're trying to move up to the level of a platform. We want to help you at all parts of the development lifecycle."

That can be seen in the formal adoption of Angular Universal, a server-side version of Angular that began as a community-developed offshoot of the client-side project.

Fluin explained that around 2009 developers began rendering more and more application code on the client-side, to make apps less likely to get bogged down by delays in receiving data from the server.

But client-side code has its own set of disadvantages, such as not being visible to some search engines (other than Google, which can render client-side web app code to index it). Also, Google Accelerated Mobile Pages (AMP) explicitly disallows client-side JavaScript from being executed and cached.

Angular Universal allows JavaScript code to be processed server-side and served to the client, Fluin explained. "We want to enable these sorts of use cases," he said.

One of the major goals with the version 4 release, said Fluin, was to avoid the breaking changes that occurred between version 1 and version 2.

"The thing we were hoping to achieve was compatibility," said Fluin. "We want to make sure people can come with us."

Beyond that, Version 4 aims to address some of the performance concerns voiced by Angular developers. The latest build reduces the size of generated code for Angular components by about 60 per cent.

Fluin said much of the initial reaction he'd seen on social media about the version 4 release came from developers pleased that their Angular app components had become so much smaller.

Along those lines, version 4 has moved the animations package out of @angular/core, so production code doesn't have to carry unneeded baggage if animations aren't necessary.

Other improvements include an expanded template binding syntax and Typescript 2.1/2.2 compatibility.

Fluin said looking ahead, the Angular team has enabled Service Worker support as an experimental feature, accessible by setting the appropriate flag. Angular apps that utilize Service Workers will work offline automatically.

He also said Angular has just released an experimental Visual Studio Code extension that taps into the standardized language service layer. The extension provides developers with a deeper understanding of their application code through capabilities like tab completion and errors at write time rather than build time. ®

Sign up to our Newsletter

Get IT in your inbox daily

Biting the hand that feeds IT © 1998–2017