7 ms·
But you know that there will be multiple implementations for every interface. At least, after IThing and Thing you will have MockThing
by _ZeD_ 6y ago
But you know that there will be multiple implementations for every interface.
At least, after IThing and Thing you will have MockThing
- eitland 6y agoFirst: Forget I<Whatever>. It breaks sorting and it is allows people to avoid thinking if the interface is necessary or not. Second: I'm not one of the hardliners wrt avoiding mocking, but if every class needs to have a corresponding mock then I'd suggest taking a step back because that shouldn't be necessary, and often in such cases I think one will also find lots of low value or even no-value tests. I'll not judge you based on a comment on an internet forum, but I think the above is a good heuristic. (With TypeScript and Java closures or anonymous types is also an option and something exist in C# as well.)
- FeloniousHam 6y ago> Forget I<Whatever>. It breaks sorting and it is allows people to avoid thinking if the interface is necessary or not. 100%. Any "structure definition" should be assumed to be an interface, and any explicit separation of definition and implmentation should be deferred until multiple variants are required. My Java projects and files were corked up with Ifiles that only ever had a single implementation. Caveat: I've only worked on internal projects, explicit interfaces are much more useful for something widely shared. Don't use the I<Class> convention though.