UML, the Unified Modeling Language, is a language for object-oriented design. We use UML diagrams, because "a picture is worth 1K words." UML class diagrams can show the important elements of and relationships between classes in a concise and intuitive way. UML is much more than just class diagrams. Other kinds of UML diagrams can illustrate how classes collaborate with one another and how users interact with classes.We will only use a small subset of UML in this book.
Most of our diagrams were created with a design tool called Umbrello.[4] For a good overview of UML, we recommend The Umbrello UML Modeller Handbook, available from the help menu of Umbrello. Another reference that provides maximum content and minimal bulk is [Fowler04].
[4] http://uml.sourceforge.net
Figure 2.1 is a class diagram with only one class: Person. Notice that the declarations appear in the name : type, Pascal-style, rather than the more familiar C++/Java style, where the names come after the types. This is to help with readabilitybecause we tend to read from left to right, this syntax helps us find names faster. Notice also that public members are preceded by a plus sign (+) and private members are preceded by a minus sign (-).
Figure 2.1. Person class
2.5.1. UML Relationships
UML is especially good at describing relationships between classes. Looking ahead to Example 2.9, we describe the subobject relationship in UML. Because the subobjects are strictly part of the parent object and cannot possibly exist as stand-alone objects, we could use the composition relationship. As Figure 2.2 shows, the filled-in diamond indicates that the object on that side is composed (partially) of the object(s) from the other side of the relationship.
Figure 2.2. Composition
Part I: Introduction to C++ and Qt 4
C++ Introduction
Classes
Introduction to Qt
Lists
Functions
Inheritance and Polymorphism
Part II: Higher-Level Programming
Libraries
Introduction to Design Patterns
QObject
Generics and Containers
Qt GUI Widgets
Concurrency
Validation and Regular Expressions
Parsing XML
Meta Objects, Properties, and Reflective Programming
More Design Patterns
Models and Views
Qt SQL Classes
Part III: C++ Language Reference
Types and Expressions
Scope and Storage Class
Statements and Control Structures
Memory Access
Chapter Summary
Inheritance in Detail
Miscellaneous Topics
Part IV: Programming Assignments
MP3 Jukebox Assignments
Part V: Appendices
MP3 Jukebox Assignments
Bibliography
MP3 Jukebox Assignments