Now, it is time to have a meeting with our domain expert, that is, someone that has an excellent knowledge of 2D geometry. We can use the UML diagram to explain the object-oriented design for the solution. After we explain the different classes that we will use for abstracting the behavior, the domain expert explains to us that there are many shapes that have something in common and that we can generalize the behavior even further. The following six shapes are regular polygons:
An equilateral triangle (the
EquilateralTriangle
class) has three sidesA square (the
Square
class) has four sidesA regular pentagon (the
RegularPentagon
class) has five sidesA regular hexagon (the
RegularHexagon
class) has six sidesA regular octagon (the
RegularOctagon
class) has eight sidesA regular decagon (the
RegularDecagon
class) has ten sides
Regular polygons are polygons that are both equiangular and equilateral. All the sides that compose a regular polygon have the same length...