649 reputation
1013
bio website
location Singapore
age 28
visits member for 3 years, 6 months
seen Oct 6 '13 at 11:44

Jun
10
awarded  Favorite Question
May
19
awarded  Yearling
Jul
9
awarded  Notable Question
May
19
awarded  Yearling
Mar
7
awarded  Notable Question
Dec
17
awarded  Popular Question
Oct
24
awarded  Notable Question
Sep
13
awarded  Popular Question
May
25
comment Dependency injection: How to sell it
I personally configure in code. If there will be a change in dependency, everything has to be rebuilt and deployed (web app). My main reason for using DI is to wire up my dependencies easily and manage lifetimes (e.g., per http request, like DependencyResolver in ASP.net MVC3). A DI container will allow me to write each component completely oblivious to its dependencies' concrete implementations and their lifetimes, which allows me to substitute mocks easily. for example, if I have a dependency on an ILogger, it wouldn't matter if it were Disposable or not, the container will handle that.
May
24
accepted Dependency injection: How to sell it
May
24
revised Dependency injection: How to sell it
added 894 characters in body
May
23
awarded  Notable Question
May
23
awarded  Good Question
May
23
awarded  Popular Question
May
23
comment Dependency injection: How to sell it
great link. Thank you, it is very informative.
May
23
comment Dependency injection: How to sell it
I agree DI does not require IoC containers. although I wouldn't call it invasive (this implementation at least) since the code was designed to be container agnostic (mostly constructor injections) and all the DI stuff happens in one place. So it still all works without a DI container - I put in parameterless constructors that "injects" the concrete implementations to the other constructor with dependencies. That way I can still easily mock it. So yeah I agree, DI is actually achieved by design.
May
23
comment Dependency injection: How to sell it
+1 very helpful indeed. I wouldn't say DI is an absolute must for unit testing but it does make things a hell of a lot easier.
May
23
comment Dependency injection: How to sell it
@Andrew valid points. Of course, i wouldn't want it to go too far. I wanted the automated testing for the business classes the most, as we have to implement very complex business rules. And I do realize I can still test them without container, but personally, it just makes sense to use a container. I actually did a little sample that showed the concept. But it wasn't even looked at. I guess my mistake was I didn't create a test that showed how easy testing/mocking is.
May
23
comment Dependency injection: How to sell it
@ChristianHorsdal I agree, I wanted it to be loosely coupled to allow easy mocking/testing.
May
23
comment Dependency injection: How to sell it
we are currently not doing any unit testing in our team. I suspect that your last statement is spot on. I have brought up unit testing a few times but nobody showed any real interest in it and there were always reasons why we cant adopt it.