I had been itching to learn a new computing language for quite some time, when a friend told me about Angular 2. I was aware of Angular’s existence for it has been universally praised, and more and more websites were choosing it as their front end language. Even Google has dedicated a team specifically for its development. The launch of Angular 4 further cements its status as a mainstay of the technological realm.
Intrigued, I decided to find a little about its performance first before learning it. Its biggest selling point is its ability to create multi-platform apps with support for web, desktop and mobile. A few additions in the code written exclusively for your web application can convert it into a desktop installed application for Windows, Mac, Linux as well as a mobile application for android and IOS. This enhanced reproducibility saves the time spent in coding for different platforms. A feature which has garnered it many loyalists. Various libraries and projects on GitHub has made it possible to develop complex applications with very few lines of code.

A major challenge with most Javascript frameworks is code organization. Other languages like Java, C++ etc. have a clear hierarchy of code with breakdown into classes, objects and functions. This makes it easy to find a bug and make code readable. Angular 2 which borrows from both javascript and the aforementioned ‘other languages’, allows for the breakdown of a code in a similar manner with Components, Directives, HTML and CSS files for particular components. The components can share the services with each other which makes the code highly organized and readable. You can make a component handle a particular view and functionality and insert it in the main application based on your use case. Services makes it easy to fetch data and perform general functions and hence is shareable across components; for example a service to fetch a list from database might be used by multiple components at different point of time and therefore a simple import of service is enough to make it accessible.

Another special feature of Angular is Ahead-of-Time ( AOT ) compilation. As mentioned an Angular application consists primarily of components, HTML and CSS files. So to run an application in a browser, first the components and typescript code needs to be changed into executable Javascript code. This can be accomplished using Just-in-Time ( JIT ) compiler but it has its shortcomings. As the application size grows it will take more and more time to compile the code first at runtime, and we will need to provide an Angular compiler so it leads to a larger application size and as we can guess bigger applications take longer to transmit and slower to load. A few modifications in the code can make an Angular application compile ahead of time. This means we are sending already executable code and the browser will skip the time required to compile it. It results in far better performance than other Javascript frameworks.

Progressive Web Apps ( PWA ) are apps which you run in your browser. With PWA you get the complete feel and look of a mobile app with no need to install it on your phone. PWA are designed to run in any browser and screen size but gets a significant performance boost in a few. With push notifications, offline support etc. PWA gives you a complete mobile app performance without ever the need to download or install it. A simple hit on the URL will convert your browser into an app. A compatibility with multiple platforms and an ahead-of-time compilation makes Angular an engine for converting your web application into a Progressive Web App.
Oozing versatility yet easy to learn, the Angular 2 framework is a good investment in a bid to unlock the language of our times: i.e. Angular.

This was written by Akshit Goel, an intern with Swaniti Initiative