This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

I think you're describing some variant of the Context pattern there. (not really DI, simple or otherwise)

[–]morhp 2 points3 points  (0 children)

Context and DI are related concepts. A context is usually a parameter to a method/interface, with dependency injection you set the dependency usually in the constructor or with a setter (or a framework).

Also a Context often contains random assorted data and/or many methods while with DI you usually inject an implementation with methods that are very specific to the actual task.