To summarize what we’ve learned so far,
Rectangle objects each have their own attributes and methods. Attributes are an object’s data, and methods are an object’s code. An object’s class defines which attributes and methods it will have.
In practice, it’s more convenient to look at high-level pictures than to examine the source code. Unified Modeling Language (UML) defines a standard way to summarize the design of a class.
As shown in Figure 10.9.1, a class diagram is divided into two sections. The top half lists the attributes, and the bottom half lists the methods. UML uses a language-independent format, so rather than showing
int x, the diagram uses x: int.
In contrast to state diagrams, which visualize objects (and variables) at run-time, a class diagram visualizes the source code at compile-time.
Rectangle have additional methods; we are only showing the ones introduced in this chapter. See the documentation for these classes to learn more about what they can do.