20.3. Creating Class Definitions from DCDs

At the very least, DCDs depict the class or interface name, superclasses, method signatures, and simple attributes of a class. This is sufficient to create a basic class definition in an object-oriented programming language. Later discussion will explore the addition of interface and namespace (or package) information, among other details.

Defining a Class with Methods and Simple Attributes

From the DCD, a mapping to the basic attribute definitions (simple Java instance fields) and method signatures for the Java definition of SalesLineItem is straightforward, as shown in Figure 20.2.

Figure 20.2. SalesLineItem in Java.

Note the addition in the source code of the Java constructor SalesLineItem(...)

Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, 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.