Hacker News new | past | comments | ask | show | jobs | submit login

If your code is a library that will be used by other people, using interfaces allows them to provide their own part for any socket even if your library only has one implementation.

It is often used by test code, for example, that wants to use a fake version of something the library provides.




> It is often used by test code, for example, that wants to use a fake version of something the library provides.

Which, by the way, is generally preferable to mocking.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: