Skip to content

Commit 2f8c0ce

Browse files
committed
Drive home point of DIP and decoupling
1 parent 13a692a commit 2f8c0ce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,11 +1084,15 @@ This can be hard to understand at first, but if you've worked with Angular.js,
10841084
you've seen an implementation of this principle in the form of Dependency
10851085
Injection (DI). While they are not identical concepts, DIP keeps high-level
10861086
modules from knowing the details of its low-level modules and setting them up.
1087-
It can accomplish this through DI.
1087+
It can accomplish this through DI. A huge benefit of this is that it reduces
1088+
the coupling between modules. Coupling is a very bad development pattern because
1089+
it makes your code hard to refactor.
10881090

10891091
As stated previously, JavaScript doesn't have interfaces so the abstractions
10901092
that are depended upon are implicit contracts. That is to say, the methods
1091-
and properties that an object/class exposes to another object/class.
1093+
and properties that an object/class exposes to another object/class. In the
1094+
example below, the implicit contract is that any Request module for an
1095+
`InventoryTracker` will have a `requestItems` method.
10921096

10931097
**Bad:**
10941098
```javascript

0 commit comments

Comments
 (0)