I have an interface:
interface DataExtractor {
public function extractData($dataSource);
}
I have ended up only having a single concrete example which is general purpose enough to serve all of my required needs.
Im am therefore left with an issue on what to name the concrete class and this leads me to ask if this is a code smell and i should not actually have the interface in the first place.
These all seem wrong
I would go with the third option--removing the interface. You will drive yourself batty putting interfaces on all your classes when you don't need the indirection; it's just confusing. Less code is better code. When you need the abstraction, that's when you should add the interface. Refactoring tools will make that task very simple when the time comes.
Benefits besides having more than one implementation -
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.