Hello, Sinix, you wrote: S> Hello, maxkar, you wrote: S> Why on the real scenario ? So your councils do not approach. The context does not have behavior, it on determination (we want to give other dial-up of services - we substitute a context) and can give as dependences, and difinienda in . Disorder otherwise begins: a part we transfer through a context, a part - through DI. Faugh-faugh-faugh And I unless stated, what on the business scenario ? The business task (main objective) just also it is necessary. But here a statement "it is necessary to create service depending on a context" the business task is not. Necessity of transmission of service is an artifact of specific implementation and before the accepted decisions. I suggest not to be focused on how it now poured out in the code. I suggest to look at the business task. And to solve it so that at level of implementation we had not "to create services depending on a context" at all. Yes, it demands sharing revising and refactorings. Probably, good DI. As a result the task turns out "to provide the necessary dynamic behavior depending on the data without application service lookup or transmissions of services". It is possible to replace "Dynamic behavior" with specific behavior from the program specification. Well and a context... context.logger.info ("Hello, world!" ) Is a behavior of a context or the service transferred through it? I here consider that if it is possible to reach service through a context its behavior is also behavior of a context (or context parts). And transmission of services through a context just adds "" to a context. Disorder in practice normally just also is not present. / the data inherent in a context, it is not enough behavior. It , the user/session. And all remaining through DI. M>> Well here all is banal. Here directly to the given code refactoring "Tell, Don't ask" is applied. Also it turns out mentioned S> Well so it angrily in the cleanest type. Instead of explicit sharing (all initialization - in one method) at us turns out a mash from S> * Actually implementations S> * Wrappers SmartConfirmationService, S> * Substituted factory which will select specific implementation. Not to do copy SmartConfirmationService for other method, say, for GetAdvancedConfirmationService And here last whence? Just in case I will specify that at me services stateless, are created in the beginning of operation of application and more never are deleted. And the dynamic behavior is reached by dispatching. Within the limits of this model the factory just is not necessary. For other method I will transfer another ConfirmationSerivce in the designer of the object containing a method. It can be both in another way configured SmartConfirmationSerivce, and other implementation. I.e. yes, at us through DI can various copies of one type. And almost any "DI Framework" that's it is not able to do it. The factory normally arises just in this case - many copies are necessary, but all objects identify only on types. There it is necessary to do one factory which will solve this () a problem. And me it is not necessary to solve it, at me in methods those services which are necessary to them are accessible exactly. Without everyones lookup. S> Here this approach "we do not look at a real problem, we can in patterns" is initially vicious, since it leads to wild recomplication of the code out of the blue. On the same example I will explain. No, is not present so. I am not engaged in activity in a type "we here to myself invented problems and now heroically them we solve". I prefer to cut at once a source of problems and to solve business tasks a convenient method. If a source of problems DI Framework - the worse for it. S> Besides a heaping of types we have one more jamb: we prolong lifetime of dependences - in original code Consumer was necessary only for obtaining of specific implementation, it is possible to transfer only implementation further. S> at you consumer it is necessary to drag further. , we remember consumer through designer SmartConfirmationService. No. We do not remember. Normally all services are created on start of application and live before its end. All remaining (including Consumer) - parameters. Services whenever possible effectively immutable/stateless. They do not have methods "to see their internal state". Just immutable, more difficult things like caches - yes, there it is necessary to do absolutely typical service accurately. Parameters of methods normally too immutable. And all changeable state - only in persistense services (it is not important, basis there or in memory service). Therefore parameter dragging - not the big trouble. Plus all artifacts in sharing it is visible. If we need to drag somewhere transitively dependence, at us possibly problem with determination various components and it is necessary . S> All? : at us a bug: consumer if it to change not that service suddenly comes. S> Ok, we define the necessary service at once, in the designer... And we appeared in an idiotic situation: The recomplicated code which as a matter of fact hides call GetConfirmationService in separate object. Hurt architecture. Here such there it will not be exact. At services lifetime is normal much more, than lifetime of parameters (requests, etc.) . Therefore through designers to them only other services are transferred. And here interfaces of services and the general sharing become so that superfluous parameters it was not necessary to transfer and that superfluous parameters transit through services not to drive. Closings on parameters sometimes for difficult algorithms, but they always a detail of implementation of a component also are not a part public API. If it was legacy, it rises in queue on refactoring. To immutable and a construction of services only on application start. M>> and here to get interfaces in a place "implementation insertions" - good. Well, there will be many small interfaces, will be Interface Segregation. S> Well, that's it about it I also spoke. Accurately to think over API - is not present, the "correct" code wrappers in a place, even breaking architecture - yes. Not, a taste question certainly, therefore even I will not argue And what "correct" means? Here is how it turned out, what at "accurately thought over API" the component had a duty which it cannot fulfill without the crutches nobly transferred to it in a call? Perhaps with allocation of duties (well and change API, yes) something not and should be changed it? I agree that "if because of architecture at us turns out difficult/not intuitive/causing questions API - in a fire chamber such architecture". By the way, even "architecture" in the given place can be treated differently. If it "rules , writing of classes and other ceremonies" - yes, it has no special value. For me the architecture is first of all high-level allocation of duties between components. Therefore any problems and nonoptimality at level API is only a consequence of problems with the selected architecture. Well and yes, it needs to be changed in that case because it does not correspond to real tasks.