26

Re: About "naive" DI and about architectural powerlessness

Hello, Sinix, you wrote: S> In the hard cases - moq/ms fakes/NSubstitute etc. In all remaining to use integration tests easier and more cheaply. The same units-tests, only all infrastructure it is already got and accessible to usage. Specificity such can at you. At me, as a rule, a situation reverse. Units-tests to write easier and more cheaply, than integration. Also they are executed on orders faster. And happened and so that good integration test basically is impossible. And the most interesting gets out in the course of pusko-adjustment. S> it though and is a little  at the initial stage, but as a result will not be such that tests green, and here to work - . In an ideal well both that and that to have the green. S> I above wrote the Big projects with necessity to support plug-ins from indirect developers. Here there DI works wonders. The most simple example - studio extensions. Compare number of extensions for the code which is cut through MEF (the editor as a matter of fact) and for what normal API only in process (lang services, debugging api etc). , DI-containers are all the same rather special case DI, instead of its native niche. The elementary DI (in the form of transmission of function or object to another) existed how started to mold in large quantities containers everywhere where only it is possible (and more often it is not necessary). Only anybody it so did not name.

27

Re: About "naive" DI and about architectural powerlessness

Hello, Lexey, you wrote: L> , DI-containers are all the same rather special case DI, instead of its native niche. The elementary DI (in the form of transmission of function or object to another) existed how started to mold in large quantities containers everywhere where only it is possible (and more often it is not necessary). Only anybody it so did not name. +1 probably "parameter" sounds insufficiently solidly and

28

Re: About "naive" DI and about architectural powerlessness

Hello, Lexey, you wrote: L> , DI-containers are all the same rather special case DI, instead of its native niche. The elementary DI (in the form of transmission of function or object to another) existed how started to mold in large quantities containers everywhere where only it is possible (and more often it is not necessary). Only anybody it so did not name. The generalizing term - control inverse. https://ru.wikipedia.org/wiki/%D0%98%D0 … 0%B8%D1%8F

29

Re: About "naive" DI and about architectural powerlessness

Hello, Sinix, you wrote: S> Hello, Lexey, you wrote: L>> And how you suggest to palm off moki/fakes without DI? S> In the hard cases - moq/ms fakes/NSubstitute etc. So here if will not be DI  from the linguistic data bases set forth above on simple  in a tested class it does not turn out. S> in all remaining to use integration tests easier and more cheaply. The same units-tests, only all infrastructure it is already got and accessible to usage. Not easier and not more cheaply. And to write more heavily average the maiden ( generally a separate trade), and  (well there for example  brakes http which it is local not  bring down tests for a server), and  they much longer. And if there are many integrations with  services all becomes S> It though and a little  at the initial stage, but as a result will not be such that tests green, and here to work - . Therefore that are necessary also and these tests: The unit locally to run and be convinced that "business did not break the logic" and integration to be convinced of serviceability of application.

30

Re: About "naive" DI and about architectural powerlessness

Hello, itslave, you wrote: S>> In the hard cases - moq/ms fakes/NSubstitute etc. I> So here if will not be DI  from the linguistic data bases set forth above on simple  in a tested class it does not turn out. Here a half-topic confuses DI with IoC, so you in good company Sorri for . If it is serious, design infrastructural API in the form of interfaces and DI - things orthogonal. To the first sooner or later come in large-scale projects all more or less. For the second with rare exception there are no reasons except as "read, I want to try". Tests are only an excuse and no more that. If your code has to be changed for the sake of tests it at you already the consequence got out. An original cause in 100 % of cases - a brothel in the project. It also should be treated. I> is not easier and is not cheaper. And to write more heavily average the maiden ( generally a separate trade), and  (well there for example  brakes http which it is local not  bring down tests for a server), and  they much longer. And if there are many integrations with  services all becomes. So here too confusion to terminology Let's not to confuse integration tests (all same testing API, only at level of large-size blocks, instead of separate types) and autotests/ui-testings (aka blackbox testing - it is used is exceptional public interfaces of a product, UI - if anything else is not present). You write about the second, I - about the first Last am allotment QA and to developers there it especially nothing to do, only to correct place which badly give in to testing.

31

Re: About "naive" DI and about architectural powerlessness

Hello, Sinix, you wrote: S> Sorri for . If it is serious, design infrastructural API in the form of interfaces and DI - things orthogonal. To the first sooner or later come in large-scale projects all more or less. For the second with rare exception there are no reasons except as "read, I want to try". Tests are only an excuse and no more that. If your code has to be changed for the sake of tests it at you already the consequence got out. An original cause in 100 % of cases - a brothel in the project. It also should be treated. There is a whole methodology TDD which the unit testing (and as consequence DI) is regarded as of paramount importance, by it popular, fashionable, youth and so on. I for example some projects made with universal DI and thousand unit of tests.  adds (percent 20 times on the average on the task), but in general - flight normal. Here that I did not find while is any metrics of usefulness of this economy. Unit tests , all . Can when at whom from  locally  breaks and . In case of refactoring these tests packs are thrown out also by packs correspond. But here is how to understand, how much it justifies itself - not clearly. S> so here too confusion to terminology Let's not to confuse integration tests (all same testing API, only at level of large-size blocks, instead of separate types) and autotests/ui-testings (aka blackbox testing - it is used is exceptional public interfaces of a product, UI - if anything else is not present). You write about the second, I - about the first I do not confuse, autotests are subspecies of integration tests But , give about  tests. Here there are 2 ambushes: - a DB. It should be, in it the correct data for each test should be prepared. Them it is necessary correctly  and to clean. This all time. At steam to one thousand tests runtime can  be tightened on half an hour that is very bad. Besides frequently it is very easy to arrange race conditions at parallel start of tests - fight because of the data in basis that in turn can force to launch them sequentially that again  beats on execution time. - a configuration. If to test the big subsystem for running of the typical scenario it is necessary to execute dance of Nanaian boys of initialization of system. Frequently it is sick and heavy. And if variables of type HttpContext are inside used. Current or DateTime. Now evening ceases to be languid - to initialize them correctly painfully, unpleasantly and not always probably.

32

Re: About "naive" DI and about architectural powerlessness

Hello, itslave, you wrote: I> There is a whole methodology TDD which the unit testing (and as consequence DI) is regarded as of paramount importance, by it popular, fashionable, youth and so on. It perfectly works for an infrastructure, almost for any scale, not bad works for small things and at all does not work even for average projects. That it was clear that such the average project: imagine typical biz-kejz in the form of the 20-page document 12 font, in which 90 % of the text - not water, and logic, and high-level, without  to separate instructions. Present code amount for this document and increase this code on 5 - you will receive the minimum for tests. And now control in a head - such cases some tens on each developer. TDD in itself in such conditions does not roll. Therefore only  all that is possible in an infrastructure (which just to cover with units-tests), only  on all code and only integration tests for business logic (for check of result and to force to work . I> I for example some projects made with universal DI and thousand unit of tests. Not, one thousand units-tests is generally about what. It is typical volume of tests for couple of months for a command from two-three persons. If we is finite about an infrastructural part we speak. I> but here is how to understand, how much it justifies itself - not clearly. So at you the code, turns out, no special value has. In sense, he can be rewritten, not  with compatibility. It a little bit depreciates tests, yes. And here when the fallen test shows that we broke behavior and it is caught at the earliest stage, still to  the code - here it is pleasant. I> - a DB. It should be, in it the correct data for each test should be prepared. Them it is necessary correctly  and to clean. This all time. At steam to one thousand tests runtime can  be tightened on half an hour that is very bad. Well so it is mandatory, especially if requests nontrivial, what else variants? The combination the CI-server + SSD + MS SQL Dev edition perfectly works. Minutes, but in any way half an hour. Otherwise already there is an occasion to profile and remove bottlenecks. Well and one thousand integration tests is already much. On a ratio to their simple units-tests it is normally good if 1 to 20. I> Besides frequently it is very easy to arrange race conditions at parallel start of tests - fight because of the data in basis that in turn can force to launch them sequentially that again  beats on execution time. Well. It is possible to contrive with a partition on groups, but what alternative? I> - a configuration. If to test the big subsystem for running of the typical scenario it is necessary to execute dance of Nanaian boys of initialization of system. It is frequently sick and heavy. Not,  it is heavy only at the beginning, then dares that or otherwise. For the big projects for integration tests an infrastructure generally launch local service not to wait, while it will be got. It certainly even more difficult also demands a separate stage at the assembly to throw there fresh assemblies, but sometimes in another way in any way. However, now in a mode fast development / start, implementers very much ask. Therefore it is on the sly crept from all crutches on standard API but that it did not brake. I> and if variables of type HttpContext are inside used. Current or DateTime. Now evening ceases to be languid - to initialize them correctly painfully, unpleasantly and not always probably. In business logic??? Yes well  to shoot for the such. It then if it is required to correct (for example, the user asks printing of forms in advance, for couple of days before actual date) - a heap of the code it is necessary to view and correct.

33

Re: About "naive" DI and about architectural powerlessness

Hello, _hum _, you wrote: __> Hello, IQuerist, you wrote: IQ>> Hello, _hum _, you wrote: __>>> and what, in your opinion, then correct methodology of development - at first not to think about DI, and only on time proprocession when the system finds outlines, already to start to think over, what it is necessary to separate as complete self-sufficient dependences? IQ>> I think yes, tools and mechanisms should be used as required instead of because so it is fashionable. __> so it is true for any case. Why you selected DI? Because about it a post. You can write a post about any other case. __>>> by the way, in the same wiki are specified  (along with advantages), including about what you speak: Dependency_injection_frameworks IQ>> Imho of the main thing is not written - the maniacal passion to IOC imposed by early implementation DI provokes violation of all principles SOLID. __> on what all the same a logical accent - on "maniacal passion to IOC" or on "earlier implementation DI"? The logical accent on misunderstanding of what problems solves the tool.

34

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: At me from DI in the project: - the Degree of the general  grew. Both designers healthy and interfaces "superfluous". + / - through interfaces everything is possible easily  anywhere. It both plus. And - implicit dependences can sprout a minus. + it is convenient  to create. Registered in a config.InSingletonScope () and all. + in tests it is possible  objects. + it is possible through  to send on errands on a live part of system. Type such. var kernel = KernelFactory. Build (); kernel. Rebind <IConfigProvider> ().To <Mock1> ().InSingletonScope ();// on what at us the component depends. kernel. Rebind <IService> ().To <Mock2> ().InSingletonScope (); var c = kernel. Get <IComponent> (); also we are played with a component in a test project. In a word: - Monstruoznenko. + Universalnenko.---------- And that in exchange offer. Such pieces? static class LoggingFactoryProvider {ILogFactory get;} static class WebServiceProvider {IWebService get;}

35

Re: About "naive" DI and about architectural powerlessness

Hello, UberPsychoSvin, you wrote: UPS> Hello, IQuerist, you wrote: UPS> At me from DI in the project: UPS> - the Degree of the general  grew. Both designers healthy and interfaces "superfluous". UPS> And that in exchange offer. Such pieces? This topic not against DI as a whole, it against "DI for the sake of DI". You it is similar though any possibilities DI use, but the majority of beginners only produces "tightly stable abstractions" from DAL helpers and constructor injection. Proceeding from projects on which to me it began necessary to work as an architectural template. Except  they do not receive anything and for any strange reason refuse to note it.

36

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: IQ> About "naive" DI and about architectural powerlessness IQ> Never I had desires  on subject DI... And in the meantime DI already got in ASP Core. And not simply got, and it is valuably supported by all levels MVC. Even there was a possibility  is direct in View. I.e. it is meant that DI it will be used (and it is used) almost in all Asp Core applications. How will live further?

37

Re: About "naive" DI and about architectural powerlessness

Hello, r.kamenskiy, you wrote: RK> And in the meantime DI already got in ASP Core. And not simply got, and it is valuably supported by all levels MVC. Even there was a possibility  is direct in View. RK> i.e. it is meant that DI it will be used (and it is used) almost in all Asp Core applications. RK> as will live further? I hope not bad categorically I welcome DI, I against unfortunate  which use it for example for  DAL helpers (Colonoscopy Injection).

38

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: IQ>  abundantly clear that naive service stuck together of  methods DAL, at all is not "abstraction". It extreme specific with extreme specific entity types even if structure of these types , and the data is copied with the help  (such a cargo-cult "").  here absolutely accurately defined problems - interfaces of top levels start to define low-level interfaces DAL. Separated  methods do not cease to be  methods of that them cause through the interface. And what image it breaks this concept? BoringItemDataReader any configuration, ConnectionString is probably necessary, for example, and even IDbContext to stable operation which normally has the lifetime and rules of creation/clearing and is accessible as a part of a subsystem which stores adjustments, i.e. separate service in your terminology. As can it is easy depend on 2-3 abstractions, a cache for example etc. I could see hand-made articles of people which considered that for implementation of an infrastructure of the project 10 classes of helpers suffices and all will be , came to an end even worse, than  with beginners DI.

39

Re: About "naive" DI and about architectural powerlessness

Hello, Visor2004, you wrote: V> And what image it breaks this concept? BoringItemDataReader any configuration, ConnectionString is probably necessary, for example, and even IDbContext to stable operation which normally has the lifetime and rules of creation/clearing and is accessible as a part of a subsystem which stores adjustments, i.e. separate service in your terminology. As can it is easy depend on 2-3 abstractions, a cache for example etc. I could see hand-made articles of people which considered that for implementation of an infrastructure of the project 10 classes of helpers suffices and all will be , came to an end even worse, than  with beginners DI. Good addition. I actually wrote a post only because those who implements "naive DI" anything you enumerated do not create and do not gather at all. They stupidly inject analogs of static classes with static  methods. A problem which I describe in other. . In propagation among beginners of idea that if to static methods of a static class to attach the interface and to create through DI. That it already  not code smell, and "good architecture". PS by the way in a consequence it generates naive REST interfaces and moving of a critical part logic business in client scripts. As I also defined earlier - Colonoscopy Injection (dependence on very specific entities and ubiquitous violation DI).

40

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: IQ> About "naive" DI and about architectural powerlessness At what here DI? A problem in excited young men (any age) who because of maximalism and inexperience "follow principles" instead of thinking. In their hands everything becomes absolute the weapon of the Doomsday for the project.

41

Re: About "naive" DI and about architectural powerlessness

Hello, Evgeny. Panasyuk, you wrote: EP> For example as alternative serivce locator. More generally - dynamic scoping. SL is the same DI, only is worse. In DI though in the contract it is visible to dependence, in difference from.

42

Re: About "naive" DI and about architectural powerlessness

Hello, IB, you wrote: EP>> For example as alternative serivce locator. More generally - dynamic scoping. IB> SL is the same DI, It is already terminological question. Look citations more low on a branch the Author: Evgeny. Panasyuk Date: 29.07 15:09 in one of places opposition, in other on the contrary a subtype. IB> only is worse. It is impossible to tell definitely worse or better as there are cases where more favourably to apply one, and is - where more favourably another. So one somewhere is worse, and somewhere another IB> In DI though in the contract is visible to dependence, in difference from. Yes, this one of advantages, but does not do automatically better".

43

Re: About "naive" DI and about architectural powerlessness

Hello, 0x7be, you wrote: 0> Hello, IQuerist, you wrote: IQ>> About "naive" DI and about architectural powerlessness 0> At what here DI? 0> the Problem in excited young men (any age) who because of maximalism and inexperience "follow principles" instead of thinking. 0> in their hands everything becomes absolute the weapon of the Doomsday for the project. Can comrade... I wrote about DI, you can write about all remaining - "everything"... By the way the curious situation, remaining "everything" not painfully that indulges concealment of architectural problems, and here at DI it turns out simply excellent... Attach to the most low-standard rubbish the interface, wrap in DI the container and you mega !

44

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: 0>> In their hands everything becomes absolute the weapon of the Doomsday for the project. IQ> can comrade... I wrote about DI, you can write about all remaining - "everything"... Well, I saw a victory of modularity over common sense. A victory of patterns over common sense (especially  Visitor). A victory of microservices over common sense. A victory message queue over common sense. Victory DDD on common sense. Well and other triumphs of forces of good over forces of reason DI here anything especially it is not selected. IQ> by the way a curious situation, remaining "everything" not painfully that indulges concealment of architectural problems, and here at DI it turns out simply excellent... Attach to the most low-standard rubbish the interface, wrap in DI the container and you mega ! Oh, yes it is fine. All of them hide one architectural problems, creating other problems out of the blue Though, of course, it not "they" (that is, patterns) and people. All problem in people and only in them.

45

Re: About "naive" DI and about architectural powerlessness

46

Re: About "naive" DI and about architectural powerlessness

Hello, 0x7be, you wrote: 0> Though, of course, it not "they" (that is, patterns) and people. All problem in people and only in them. Well it is fine our branch  it is constructed  not in public, and on ideas. And ideas belong to communities. So the reason should be in any communities which spread incomplete ideas

47

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: IQ> Well it is fine our branch  it is constructed  not in public, and on ideas. And ideas belong to communities. So the reason should be in any communities which spread incomplete ideas)) You try to force ideas to write to you the program without people Or take casual any passers-by, give them the book with the correct ideas and look that they to you make

48

Re: About "naive" DI and about architectural powerlessness

Hello, 0x7be, you wrote: 0> Hello, IQuerist, you wrote: IQ>> Well it is fine our branch  it is constructed  not in public, and on ideas. And ideas belong to communities. So the reason should be in any communities which spread incomplete ideas)) 0> You try to force ideas to write to you the program without people much more interesting that people without ideas write. 0> or take casual any passers-by, give them the book with the correct ideas and look that they to you make Incorrectly ideas belong to communities. Ideas stated in books it  again private presentation of private vision...

49

Re: About "naive" DI and about architectural powerlessness

Hello, IQuerist, you wrote: 0>> You try to force ideas to write to you the program without people IQ> much more interesting that people without ideas write. I saw such. Normally it somehow works, but inside an infernal hell. And when excited young men undertake to do "all on mind" it does not work, and inside an infernal hell. A difference only that under each element of this hell of the young man clever words why so it is made can tell many. Between these two variants I select the first 0>> Or take casual any passers-by, give them the book with the correct ideas and look that they to you make IQ> Incorrectly ideas belong to communities. Ideas stated in books it  again private presentation of private vision... What is not true? Make any statement, and that dispute was at a deadlock

50

Re: About "naive" DI and about architectural powerlessness

Hello, 0x7be, you wrote: 0> Hello, IQuerist, you wrote: 0>>> You try to force ideas to write to you the program without people IQ>> much more interesting that people without ideas write. 0> between these two variants I select What sense first I by the way too to do investments in undoubted ... The code. 0>>> or take casual any passers-by, give them the book with the correct ideas and look that they to you make IQ>> Incorrectly ideas belong to communities. Ideas stated in books it  again private presentation of private vision... 0> That is not true? 0> make any statement, and that dispute was at a deadlock Yes, over-philosophy  it  from another