Throughout the book, I have used diagrams to represent the state of running programs.
In Variables, we used a state diagram to show the names and values of variables. In SStack diagrams I introduced a stack diagram, which shows one frame for each function call. Each frame shows the parameters and local variables for the function or method. Stack diagrams for recursive functions appear in Stack diagrams for recursive functions and More recursion.
Attributes introduces object diagrams, which show the state of an object’s attributes, and their attributes, and so on. Rectangles has object diagrams for Rectangles and their embedded Points. Time shows the state of a Time object. Class attributes has a diagram that includes a class object and an instance, each with their own attributes.
Finally, Class diagrams introduces class diagrams, which show the classes that make up a program and the relationships between them.
These diagrams are based on the Unified Modeling Language (UML), which is a standardized graphical language used by software engineers to communicate about program design, especially for object-oriented programs.
UML is a rich language with many kinds of diagrams that represent many kinds of relationship between objects and classes. What I presented in this book is a small subset of the language, but it is the subset most commonly used in practice.
The purpose of this appendix is to review the diagrams presented in the previous chapters, and to introduce Lumpy. Lumpy, which stands for “UML in Python,” with some of the letters rearranged, is part of Swampy, which you already installed if you worked on the case study in Case study: interface design or Case study: Tkinter, or if you did Exercise 15.4 in Exercises,
Lumpy uses Python’s inspect module to examine the state of a running program and generate object diagrams (including stack diagrams) and class diagrams.