Angular 6 for Enterprise:Ready Web Applications
上QQ阅读APP看书,第一时间看更新

Angular's philosophy

The philosophy behind Angular is to err on the side of configuration over convention. Convention-based frameworks, although may seem elegant from the outside, make it really difficult for newcomers to pick up the framework. Configuration-based frameworks, however, aim to expose their inner workings through explicit configuration elements and hooks, where you can attach your custom behavior to the framework. In essence, Angular tries to be non-magical, where AngularJS was a lot of magic.

This results in a lot of verbose coding. This is a good thing. Terse code is the enemy of maintainability, only benefiting the original author. However, as Andy Hunt and David Thomas put it in the Pragmatic Programmer,

Remember that you (and others after you) will be reading the code many hundreds of times, but only writing it a few times.

Verbose, decoupled, cohesive, and encapsulated code is the key to future proofing your code. Angular, through its various mechanisms, enables the proper execution of these concepts. It gets rid of many custom conventions invented in AngularJS, such as ng-click, and introduces a more intuitive language that builds on the existing HTML elements and properties. As a result, ng-click becomes (click), extending HTML rather than replacing it.