I have never quite understood the second part of the phrase...
'High-level modules should not depend on low-level modules. Both should depend on abstractions (e.g., interfaces)'
If I changed...
class Upper {
foo = () => {
console.log('bar')
}
}
to...
class Upper {
foo = () => {
let lower = new Lower()
lower.bar()
}
}
class Lower {
bar = () => {
console.log('bar')
}
}
We would say that I have successfully inverted dependencies because now the console code cannot break the high level module (it's in a wrapper).
The abstraction in this case is the interface 'Lower', but the console code does not DEPEND on 'Lower' does it? It depends on nothing. It's just 'code'.
I guess my real question is what exactly denoted a 'dependency' in this case?