Interfaces and Unit testing

Kagamin spam at here.lot
Fri Feb 18 07:22:42 PST 2011


Erik Meer Wrote:

> Does using interfaces extensively have a performance drawback like using inheritance has?
> 
> Why do I ask? I was thinking about adopting a coding practice where I define explicit interfaces for all public aspects of my classes, and then couples the interfaces closely to unit tests. Then, whenever I would create a new class using some of these interfaces the unit tests would tag along, which means the unit tests would be reusable.
> 
> Now, if the compiler has do align stuff in some arduous way to accommodate these interfaces then this whole idea might not be worth it? Or are interfaces a no-cost constraint on the implementation?
> 
> Erik Meer

So you want interfaces only for unittests and won't use them in your code?


More information about the Digitalmars-d mailing list