3 ms·
This hoists all dependencies to the top level, it looks decent because the dependency graph is entirely static. Suppose you want more runtime flexibility, such
by jedbrown 16y ago
This hoists all dependencies to the top level, it looks decent because the dependency graph is entirely static. Suppose you want more runtime flexibility, such as replacing every instantiation with a runtime choice between 3 implementations. Note that this usually changes the topology of the dependency graph since each implementation requires a different selection of internal objects (involving more runtime choices).
Some applications don't require this sort of runtime flexibility and they have dependencies that are not likely to change in future versions, in which case it may be fine (even preferable) to dump all the dependencies on the user.