SOLID software design principles
Software design principles, as applied to object-oriented programming, provide guidelines for how you construct your classes. Unlike patterns that are tied to specific coding requirements, principles should be considered for any code that you write every day. There are numerous principles, but we will look at five principles that fall under the acronym SOLID.
S – Separation of concerns/single responsibility
In my opinion, separation of concerns may be the most important of the principles. Simply put, it directs us to design classes that are responsible for a specific function in the program. We have seen this already in Chapter 5, Language Fundamentals – Classes, in the Class organization based on functionality section, where we took the CompoundInterest05
program and organized the classes based on functionality:
Figure 10.1 – Class organization for the separation of concerns principle
What we...