Home > Articles > Software Development & Management > UML

  • Print
  • + Share This
This chapter is from the book 20.3 Creating Class Definitions from DCDs

20.3 Creating Class Definitions from DCDs

At the very least, DCDs depict the class or interface name, superclasses, operation signatures, and attributes of a class. This is sufficient to create a basic class definition in an OO language. If the DCD was drawn in a UML tool, it can generate the basic class definition from the diagrams.

Defining a Class with Method Signatures and Attributes

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

Figure 20.1 SalesLineItem in Java.

Note the addition in the source code of the Java constructor SalesLineItem(ノ). It is derived from the create(desc, qty) message sent to a SalesLineItem in the enterItem interaction diagram. This indicates, in Java, that a constructor supporting these parameters is required. The create method is often excluded from the class diagram because of its commonality and multiple interpretations, depending on the target language.

  • + Share This
  • 🔖 Save To Your Account