Hi, I know programming to an interface is best practice, but on a practical level i'm struggling to get my head around why sometimes. I'm creating a news section on our site, with 2 different types of news. They both implement a very similar set of methods, and so my thinking is that i should probably create a news interface, which internal_news and external_news implement.
That's fine, but on a real level, what benefit do I get from having the interface at all in this case. It doesn't really feel like its particularly helping loose coupling, although i know thats the reason for it.
Any pointers on this would be greatly appreciated!
- In the future you might want to add another type of news. The framework will be the same, working with the interface, with minimal changes. - You can use the interface in another application. For example you can send it to me, I'll write an application that interface, while you'll writing implementations of news, in the same time. When ready my application can work with your implementation, like a plugin.