There is no doubt that React is causing a front end upheaval when it comes to choosing a method of coding interfaces. Angular feels like it’s been in the market for a long time. However, in reality, the framework as we currently know it was only released in 2016. React, initially released in 2013, only gained major publicity traction after Facebook changed their BSD license to MIT.
In hindsight, the Angular team should have called it something else since it is so far removed and very different from the original Angular.js and just let that one die a slow silent death.
So what’s the big deal with Angular? and why, exactly, are developers still using and recommending it?
Opinionated Architecture
React is more geared towards being as flexible as possible, giving developers the choice of architectures and structures. Angular, however, enforces a certain structure onto the project.
Angular operates on a highly opinionated architecture — which means that your Angular app has to be written in a certain way for things to work properly. While this may sound rigid, the major perk is that once you learn the structures, every Angular app that you’ll ever come into contact will have something similar.
You can always expect the three piece creation of css, Angular component and html for your view at minimum. With React, its flexibility is also its weak point where junior or new React developers can create without restrictions, baking into bad practices or shaky architectures. It’s not their fault, not really.
Best practices come to fruition after enough mistakes have been made and best known solutions come to light. Angular forces these solutions on you in order to maintain a sense of cohesion in the way things are done.
Historically, this wasn’t present in Angular.js. The original version of Angular had a more free reign approach, similar to React’s ability to coincide with any existing application. However, as applications grew and teams changed, there’s a higher chance of the application breaking separations of concerns, resulting in a glop of code that eventually needed to be thrown out.
Angular’s new and enforced approach to architecture solved this issue, resulting in applications that are uniformed with a certain level of industry standards enforced.
The CLI
The CLI has come a long way over the years, generating bare bones templates that utilizes best practices and structures.
Yes. React also has a CLI too but there is a difference between the two semi-official tools.
As frontend development grows in complexity, CLI is a tool to help get things up and running much faster through generations of templates in spaces that you need and want. Angular’s CLI is robust with the ability to generate code on the scaffold generated, making it highly flexible when adding new logic and components into the application.