Spaghetti code. Big Ball of Mud. If you've been writing code for at least a couple of years, you are likely to know these terms. You have certainly seen or perhaps contributed to a project so unmaintainable that you placed bets on the day it would collapse under its own weight. However, if you stepped back and dug a little deeper into the history of the project, you would likely discover that it began with honorable intentions.
Nobody sets out to write bad code. Nobody sets out to write unmaintainable code. Whether it's the urgency to get a project complete on time, proof-of-concept code that unexplainably made it to production, or some other external force of business, sometimes we just end up writing unmaintainable code.
In this chapter, we will discuss ways in which we can design our classes and structure our app to make it more maintainable and, by proxy, make it more testable by exploring the SOLID principles of class design. These principles, if adhered...