Tell me what’s wrong with this simple piece of code:
public class MyService : IMyService, IDisposable { private readonly IOtherService _otherService; public MyService(IOtherService otherService) { _otherService = otherService; } public void Dispose() { _otherService.Dispose(); } }
The answer is very simple: “I created you and I will be your end”, yet MyService didn’t create IOtherService, thus it has not right to call Dispose() on the service.”
Yet, at Mizuho, I saw many developers lacking this simple, yet critical design concept!
</rant>