The Structure of a Class Diagram

A class diagram is constructed of three different parts: the class name, the attributes, and the methods (constructors are considered methods). The class diagram is essentially a rectangle that separates these three parts with horizontal lines. The book often uses a cabbie metaphor as an illustration. Figure 10.1 shows the UML class diagram representing this class.

Figure 10.1. A UML diagram of the Cabbie class.

This UML diagram corresponds exactly to the following Java code:

 /* This class defines a cabbie and assigns a cab */ public class Cabbie { // Place the name of the company here private static String companyName ...

Get Object-Oriented Thought Process, The, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.