News for hackers. Stuff that matters.
Re:Why I Hate Frameworks (2005) by solutionyogi on Saturday March 14, 2015 @05:48PM (#9204309)
1. This was not written by Joel himself. This was written by a guy named Benji Smith on JoS forum.

2. I understand dependency injection completely but question if it's really required to write quality software OR is it a technique you use because programming languages are lacking.

Let me give you an example. In .NET world, there is a product called, Isolator by a company called TypeMock. It can let you mock any type/method by exploiting CLR.

In .NET, there is a type called System.DateTime with a static property DateTime.Now. I have seen code where people try to write interfaces to inject DateTime.Now. And I think it's an overkill. When I saw their example of how they can mock DateTime.Now without doing DI, I am personally convinced that DI is about addressing limitations of your statically typed language and is not an absolute must.

http://www.typemock.com/TypemockIsolatorExamples

Re:Why I Hate Frameworks (2005) by zby on Saturday March 14, 2015 @06:17PM (#9204403)
Mocking is global - when you need two objects that need to have two different DateTime.Now - then you are out of lack if you mock it. DI is just a bit more universal than mocking. On they other hand mocking is simpler - agreed.

Thanks for correcting me about who was the author.

Re:Why I Hate Frameworks (2005) by robotkilla on Saturday March 14, 2015 @05:55PM (#9204334)
> if it's really required to write quality software

of course it isn't. if your program doesn't require dependency injection and you architect it for dependency injection, that isn't quality software.

Re:Why I Hate Frameworks (2005) by solutionyogi on Saturday March 14, 2015 @06:03PM (#9204355)
Here's the current status of .NET software development.

I think there is a broad agreement that unit testing is a very useful tool in developing quality software. Because of the inherent limitation of C#, you can't unit test easily if you don't use DI. This often leads to a situation where you have tons of interfaces + each interface is implemented exactly by one class. This is because product like Isolator is not free. Hyptothetically, if Isolator was provided by Microsoft for free, I am sure that we will see reduced usage of DI.

Don't get me wrong, I think there are other scenarios where DI is a great technique in designing components which are flexible. However, those scenarios are not that many. Using DI to make your software unit testable is an overkill IMHO.