7. UML

Programs coded with DOL have been UML driven (MDA=Model Driven Architecture) since 1989, long before this term has been invented. The ZZ_HYPER statements describe the connectivity of the UML class diagram and have the role of the textual form of the UML diagram.

On the other hand, every time you run the DOL code generator (zzprep), a picture with the UML class diagram is automatically generated. In addition to the code with your customized data structures, zzprep generates file layout.inp with re-formatted ZZ_HYPER statements and the description of the inheritance among your classes. When you feed this file to the layout program from the Code Farms' incode package, you get a nicely layed-out UML diagram (file display.svg). You can display this diagram with your Internet browser or using one of the specialized svg display packages. Program layout is not a part of the DOL, but it is an OpenSource package which you can download free from http://www.codefarms.com .

The advantage of using the textual UML diagram is that the architecture of your software is centrally controlled. The code and its UML diagram are integrated and synchronized -- neither can be out of date. The graphical UML diagram is available at all times, and if you want to edit it, you don't do it in a graphical environment by shifting boxes and connecting them with lines. Instead, which is faster and safer, you edit the ZZ_HYPER statements and the layout program takes the care of producing a neat looking diagram.

Let's look at how this works with Example 1 from Chap.6. The data structure (the architecture) there was described by the following statements

ZZ_HYPER_SINGLE_COLLECT(inst,Chip,Instance);
ZZ_HYPER_SINGLE_COLLECT(nets,Chip,Net);
ZZ_HYPER_SINGLE_COLLECT(lib,Library,Master);
ZZ_HYPER_SINGLE_AGGREGATE(terms,Master,fTerm);
ZZ_HYPER_SINGLE_AGGREGATE(byInst,Instance,aTerm);
ZZ_HYPER_SINGLE_AGGREGATE(byNet,Net,aTerm);
ZZ_HYPER_SINGLE_COLLECT(pins,fTerm,fPin);
ZZ_HYPER_SINGLE_LINK(iLink,Instance,Master);
ZZ_HYPER_SINGLE_LINK(tLink,aTerm,fTerm);

If we assume that these statements, together with the definitions of all the participating classes, are in file test.h, with the implementation in file test.cpp, then the following little batch file runs the code generator (zzprep), generates the UML diagram (call to layout), and compiles the program using the line version of the VC++ compiler:

c:\orgc\zzprep test.h c:\incode\layout\layout -s param.txt layout.inp cl test.cpp d:\orgc\lib\mllib.lib REM the new UML diagram is in display.svg

File param.txt is a little file which describes the size of your screen and the proper size of the font for the UML diagram. This file can be either automatically generated or manually coded -- for detailed description, see the documentation for the layout package.

When displayed with Internet Explorer, the file generated by this batch file (display.svg), produced the following diagram. Note that the quality of the graphics deteriorated after reducing the size for this documentation:

Compare the UML diagram with the hand sketched diagram from Chap.6. The UML diagram is cleaner and more meaningful while providing additional details.

 

Chapter 6: Examples Floppy or Tape Chapter 8: Syntax