I have a very simple application which needs a data source. At present it is a flat file but later on it will change to a database. I need your opinion on using inheritance or interfaces here. Which one would be better and why? My opinion is using interfaces because it would be flexible but then i could make data source as an abstract class too.
Share
You would use an abstract class where there is common functionality that all the implementations need access to. Here the database and file implementations are so different they will have nothing in common, so I’d go with interfaces.