If we ever going to change kDBConnection
class, that is responsible for all database related interactions, then we must ensure that kDBLoadBalancer
class, that allows to manage master/slave setups would also work. It's easy to forget adding a corresponding method to kDBLoadBalancer
class for every kDBConnection
class method.
To solve that problem I propose to create a public interface out of kDBConnection
class and make both kDBConnection
and kDBLoadBalancer
implement it. This way PHP won't even allow to run a script if we don't add method to both classes.
What we must take care of anyway is to keep public interface up to date first.