Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • I understand dependency inversion, but does that mean that all program objects have to be instantiated by main? This doesn't seem feasiable for large program. If you have large parts of a program, for example, data layer, notification layer, auth layer, then each of these layers might have very many small objects, which may not get instantiated by main. What about in that case? Commented Jul 16, 2018 at 9:45
  • Not all objects are instantiated on the top, for objects that are instantiated elsewhere, you can instantiate a factory with the parameters already present, etc. Some parameters can be even passed along. Also, it does not matter how "large" you application is. At all. You have to use decomposition to arrive at manageable chunks/modules/whatever, so at the top a really large application might not differ at all from a small application. Commented Jul 16, 2018 at 10:11