Why AngularJS makes every single developer a better one

Why AngularJS makes every single developer a better one
Photo by Christopher Gower / Unsplash

I was recently asked by a client why I prefer AngularJS as client-side JavaScript library in projects I deliver. I thought about it for a while and could have mentioned a million technical reasons, but I replied:

Because it kindly stimulates any developer to deliver better code by promoting the use of proven design patterns without being overly opinionated.

I strongly believe that is also the reason why working with AngularJS makes every single developer a better one.

Out of the box. No strings attached. For free. Guaranteed. Period.


AngularJS doesn't require you to know a thing about design patterns. Understanding design patterns will definitely help you understand (and appreciate) AngularJS, but it is not required.

AngularJS kindly offers convenient wrappers, facades, and factories to seamlessly let you use proven design patterns without you almost realizing it.

Any developer

After working together with many different teams of developers in the past, I have noticed that most developers have their own programming style. In some cases, you can almost tell who wrote some piece of code simply by reading it. Sometimes I liked reading the code, sometimes I didn't, even though the code worked perfectly.

AngularJS provides the necessary building blocks to leverage these styles in such a way that the end result is a comprehensive bundle of modules that is easy to use by other developers without requiring the whole team to know the inner workings of each module.

It conveniently provides developers with the freedom to program in their own style, but deliver pieces of code that can fluently be used by others without requiring large amounts of documentation.

By promoting the use of proven patterns to any developer, AngularJS can save you tons of frustration, time and money.

Proven design patterns

The true power of AngularJS' API is that it lets you conveniently apply design patterns out of the box, making your own code more re-usable, reliable, easier to test, and above all simply better, because design patterns are patterns that are proven to provide solid solutions to problems.

It's not about how AngularJS is written, it's about the quality of the code it lets you produce.

If you read JavaScript design patterns, a great free book by Addy Osmani, you will recognize many concepts used by AngularJS as proven design patterns.

This post is not meant as a technical study about all patterns used in and promoted by AngularJS, but here are a few examples:

Module pattern

AngularJS is built around modules and every application is defined as a module:

angular.module('yourModule', ...);

Each module can specify other modules as dependencies, allowing a developer to easily use existing modules without knowing the exact inner workings of every module.

Singleton pattern

Services in AngularJS are singletons, meaning they are only instantiated once:

angular.service('yourService', ...);

Factory pattern

Although AngularJS offers the angular.service() convenience method, it is actually a wrapper around another method implementing the factory pattern:

angular.factory('yourFactory', ...);

Observer pattern

You can watch properties of scopes and assign listeners to execute when a property changes:


Publish subscribe pattern

At the same time every $scope can let you $broadcast or $emit events, and attach event handlers that listen for such events using the $on method. The scope basically acts as the middleman between publisher and subscriber to promote loose coupling:


Decorator pattern

Service decorators allow you to modify service behavior:

$provide.decorator('yourDecorator', ...);

Without being overly opinionated

AngularJS is sometimes blamed for not being opinionated enough in comparison to other JavaScript frameworks.

In my opinion that is what makes AngularJS so powerful:

  • It does not require you to instantiate some base class to create a view.
  • It does not offer you some out of the box model for handling collections.
  • It does not require you to return objects implementing a predefined API.
  • Etc.

As a consequence it is often mistaken for something it is not.

AngularJS is a foundation that offers great programming structures to help you build your own web application framework.

Deliver better code

While AngularJS is primarily known for popular features such as "two-way binding" and "directives", the main benefit for me has proven to be a non-technical one in that it kindly lets any developer use the built-in AngularJS methods to write quality code without having to know anything about design patterns.

And thus letting every member of the team build upon experiences of many developers that came before us.

Making every single developer in the team a better one.

Making every team better.

Thank you AngularJS!