3 ms·
If java is any guide developers would go out of their way to add interfaces everywhere anyway, often they're essentially header files for the OO gods.
by flukus 8y ago
If java is any guide developers would go out of their way to add interfaces everywhere anyway, often they're essentially header files for the OO gods.
- kjeetgill 8y agoI haven't done any C++ in a while, can you swap out the implementation backing a header? I suppose at the linker layer maybe but even that is just once globally for the program. Right? The OOP God's demand polymorphism! If memory serves me, the C++ version is a class with all empty virtual functions.
- flukus 8y agoYeah, it can only be swapped out at link time (without crazy magic). That satisfies two very common cases though, when there is only one implementation (and the interface is a sacrifice to the OOP gods) and when the second implementation is for unit testing only. Those 2 plus other crazy rules (like only one interface defined per file) mean that many projects will end up with just as many interface files as a c++ project would header files.