Chapter 11. UML and Programming

Chapter 11. UML and Programming

So far, I have discussed a lot of notation. One large question looms: How does a programmer actually use the UML as part of the daily grind of programming? I'll answer this by talking about how I use the UML when I'm programming, even on a small scale. I won't go into a lot of detail, but I hope this will give you a sense of what you can do with the UML.

Let's imagine a computer system designed to pull together information about patients for a hospital.

Various health care professionals make observations about patients. This simple system will allow someone to get information about those observations and to add additional observations. As this is a short book, I will wave my arms about the database links and the UI and consider only the basic domain classes.

This is such a simple example that it has but a single use case, named "review and add patient observations." We can elaborate on that with a few scenarios.

  • Ask for the latest heart rate of a patient.

  • Ask for the blood type of a patient.

  • Update a patient's level of consciousness.

  • Update a patient's heart rate. The system marks the rate as slow, normal, or fast, according to the system's built-in ranges.

My first step in the process is to come up with a conceptual model that describes the concepts in this domain. At this stage, I'm not thinking about how the software is going to work, only about how to organize concepts in the minds of the doctors and nurses. I'll start with a model based on several analysis patterns from Fowler (1997): Observation, Quantity, Range, and Phenomenon with Range.