Chapter 5. Modeling Your Programs with UML
In This Chapter
Using some UML extras, such as packages, notes, and tags
Taking advantage of the freedom UML gives you
Creating C++ enumerations in UML
Using static members in UML
Notating templates with UML
In this chapter, we give you some miscellaneous details about using UML. After you understand how to use the diagrams and have a feel for a methodology or process, read this chapter for interesting details about UML. For example, you can use several symbols in any of your diagrams to make them more descriptive; we discuss those here. We also talk about how to show various C++ features in UML.
Using UML Goodies
The UML specification is huge. We're talking big. So in this section we give you some additional information you can use when creating UML diagrams.
Packaging your symbols
In computer programming, a common term is namespace. When you have functions and classes and variables, you can put them into their own namespace, which is nothing more than just a grouping. When you do so, the names of the functions, classes, and variables must be unique within the namespace. But if you create another namespace, you can reuse any of the names from the other namespace. In technical terms, identifiers must be unique within a namespace.
To make this clear, let us show you a C++ example. In C++, you can create a namespace by using none other than the
namespace keyword. Have a gander at Listing 5-1 — and bear in mind that
using namespace std; line you see ...