O'Reilly logo

Dependency Injection with AngularJS by Alex Knol

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The theory behind Dependency Injection

We have now used Dependency Injection and seen it in action. By now you should have a decent grasp of why it is useful, but what about the theory behind it? Let's start with SOLID. This is a basic principle by Robert C. Martin that was introduced in the year 2000. It is an acronym that describes the five basic principles of object-oriented software design. It advocates a method of development that allows you to produce software that can easily be extended and is also easier to read. The following table lists the five SOLID principles:

Initial

Stands for

Concept

S

Single responsibility principle (SRP)

This principle states that a class should have only a single responsibility.

O

Open/closed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required