Deep dependencies (npm style) are great when (1) you are relatively memory/bandwidth unconstrained, and (2) your programming style is purely functional. (1) is pretty obvious, so I want to elaborate on (2):
With an object-oriented programming style, you are often passing around instances of your class.
var widget = new Widget
widget.groupWith(otherWidget)
You clearly don't want widget
to interact with slightly different versions of itself through otherWidget
. (Trying to do so would require that we are extremely disciplined with what the Widget::groupWith
method calls on otherWidget
.) Asking for this to work is, in my opinion, a fundamentally bad idea from an architectural point of view. Ideally, it should not be possible for two versions of the Widget
class to exist in the same app. Bundler on Ruby enforces this, and it's awesome.