- Oct 18, 2010
Interfaces have a couple of benefits. If you only look at one then you might think it its too much effort for what it's worth. If you look at the other benefits it gives the full picture for you to see its worthI think that might confuse him more tbh. He's learning the basics and I think you need to understand interfaces to understand dependency injection.
- You can inject another object that implements that same interface for unit testing. So for testing instead of using a database repository object/ web service you can inject your own dummy object that implements that returns dummy data
- It's very easy to pass objects around using its interface so if you change to a different object you don't have to change all the references e.g. lots of collection objects implement IEnumerable.