2.5.  Introduction to UML

[ fromfile: introuml.xml id: introuml ]

A modern, object-oriented application rests upon a foundation of well-designed classes. In most projects, general purpose libraries (such as Qt) and task-specific libraries supply some of the classes. The programmer supplies the others. The Unified Modeling Language (UML), is the most commonly used language for object-oriented design. It permits a designer to describe the project using a rich variety of diagrams. We use UML diagrams because "a picture is said to be worth about 1k words." For example, UML class diagrams can show the important or relevant elements of classes, and the relationships between them, in a concise and intuitive way. Other kinds of UML diagrams can illustrate how classes collaborate with one another and how users interact with class objects. In this book you will use only a small subset of UML.

Most of our diagrams were created with a design tool called Umbrello. For a good overview of UML, we recommend "The Umbrello UML Modeller Handbook," available from the help menu of Umbrello. A more complete reference that provides maximal content and minimal bulk is [Fowler04].

Figure 2.1.  Person Class

Person Class

Figure 2.1 shows a class diagram with only one class: Person. Notice that the declarations appear as name : type, Pascal-style, rather than the more familiar C++/Java style, where the names come after the types. This is to help with readability: Because we tend to read from left to right, this syntax can help you to see the member names faster. Notice also that public members are preceded by a plus sign (+) and private members are preceded by a minus sign (-).