2 ms·
DI is still relevant for dynamic languages, for two reasons: - it lets you put your dependencies all at the same place - it lets you define clearly what the d
by mercurial 14y ago
DI is still relevant for dynamic languages, for two reasons:
- it lets you put your dependencies all at the same place
- it lets you define clearly what the dependencies of a piece of code are, without having to look at internals which may change tomorrow without warning
One thing I find aggravating with dynamic languages is that metaprogramming is a crutch people tend to rely on because they can't be bothered to write clean APIs. In my experience, it's particularly prevalent in Ruby.
Of course, the lack of dynamism can be a problem in statically typed languages, giving Spring's or Hibernate's stacktraces of hell with piles of proxy objects.