SRP – simple building blocks
In this section, we will examine the first principle, known as SRP. We will use a single code example throughout all sections. This will clarify how each principle is applied to an object-oriented (OO) design. We’re going to look at a classic example of OO design: drawing shapes. The following diagram is an overview of the design in Unified Modeling Language (UML), describing the code presented in the chapter:
Figure 7.1 – UML diagram for shapes code
This diagram shows an overview of the Java code available in the GitHub folder for this chapter. We’ll be using specific parts of the code to illustrate how each of the SOLID principles has been used to create this design.
UML diagrams
UML was created in 1995 by Grady Booch, Ivar Jacobson, and James Rumbaugh. UML is a way of visualizing OO designs at a high level. The preceding diagram is a UML class diagram. UML offers many other kinds of useful...