I maintain and work on a number of legacy code applications. One of them has earned itself some refactoring. So I’ll try to share some of the changes I’ve been making to improve it. Today, a problem that’s bothered me for a while: the DB class connects to the database even if no queries are being used.
I should be thankful that this legacy app doesn’t have a bunch of mysqli_* calls all over the place. Back when I wrote it I at least had the presence of mind to wrap SQL functions in an abstraction class. So this change was quite easy to make.
Continue reading “Bite Sized Code Refactoring – Redundant DB Connections”