4 ms·
If I had to state a law about how to do OOP correctly it would be: - A base class and its implementation(s) must never be written by the same person. Obviousl
by d--b 4y ago
If I had to state a law about how to do OOP correctly it would be:
- A base class and its implementation(s) must never be written by the same person.
Obviously a bit of a strong opinion, but inheritance should delimit layers of abstraction, technically separating the responsibility of developers.
- bluGill 4y agoA base class should only exist where there are implementations -it needs to be plural. Otherwise just fold the base into the child, or better yet use composition not inheritance. I generally do not count any form of test double (mock...) as a an implementation, since only rarely is the real implementation something that you should mock.