(no title)
acupofnope | 5 years ago
Construction injection is a type of DI, and it's optional, you don't have to use it.
edit: for clarity
acupofnope | 5 years ago
Construction injection is a type of DI, and it's optional, you don't have to use it.
edit: for clarity
mandeepj|5 years ago
acupofnope|5 years ago
That sounds like dogmatism, and I'm going to take a special note of the emotionally charged language you're using here; it's symptom of some of the underlying issues I see in our industry (more to be said on this).
That said, I do agree with the sentiment in general, but you can (and sometimes should) use the `new` keyword in your code, especially when writing tests. In some cases, it makes testing so much easier and helps with the maintainability.
"I hope you'll not reply-with saying "don't write unit tests"
After 2 decades in this profession, the only think I'm sure of is there is no "silver bullet". Of course, as a general rule, it's a good idea to have a test coverage of your codebase but sometimes it's not valuable and not worth adding it. So it's a "it depends" from me!
Thiez|5 years ago