To make this easier we will use a piece of software designed for teaching, Umple, rather than going straight to the industrial strength (but more complex) software we'll use for most labs. We will use the online service Umple Online (open that link in a new tab now). A known problem is that it may struggle with the number of simultaneous users we have. Therefore you'll work in pairs for this lab. Let me know if it becomes too unresponsive even so!
Look at Umple... listen to the explanation of what it is...
Follow the page Hello World Examples of the Umple user manual. Have a play. Notice that the textual representation on the left looks a lot like Java but is not Java: you can generate Java using the button in the middle. Look carefully at the Java that is generated, and compare the Umple code (on the left) with the UML diagram (on the right). Try generating code in other languages. Tweak things and regenerate, understand what changes...
Ootumlia Airlines runs sightseeing flights from Java Valley, the capital of Ootumlia. The reservation system keeps track of passengers who will be flying in specific seats on various flights, as well as people who will form the crew. For the crew, the system needs to track what everyone does, and who supervises whom. Ootumlia Airlines runs several daily numbered flights on a regular schedule. Ootumlia Airlines expects to expand in the future so the system needs to be flexible: in particular, it will be adding a frequent-flyer plan.Develop a conceptual class model for the reservation system. Start by identifying key classes, and add associations and attributes. Are there any generalizations? Finally, look at the version under the Airline entry in the Examples menu. Are there differences from what you developed? Discuss why that might be. (It does not necessarily mean your version is wrong!)
Here you will find a collection of Java code. Download and unzip it. Your task is to try to build a UML model which generates exactly this Java code.
You may find a shell for-loop useful for checking, e.g. if the given code is in directory Java and the code generated from your current model is in Java1, you could look at the remaining differences using this shell command:
for file in `ls Java`; do diff Java/$file Java1/$file; done
(Note that if there are no differences, as you wish, then the slightly disconcerting result of this command is that it will print nothing at all. If you want to verify that that's what's happening, put a dummy change in one of the files, creating a difference, and verify that if you rerun the command that one does get reported!)
As you go, look carefully at the generated code. Look particularly at what it does with attributes and associations. How are the choices you make for multiplicities connected with the code that gets generated? Do you see any oddities in the generated code, and can you explain why the developers of the code generator have made the choices they have? Are there any places where, to do this artificial exercise, you have to make choices in your model that actually don't matter? Are there any differences you can't eliminate?
Add a new transition to represent that if a Booking receives a message unchecking while it is in state checkedIn, it goes back to state seatAssigned.
Generate Java code and examine it. What happens if a Booking object receives a cancel message while in state Completed? Is this a problem? What else might you have expected? Later, look into the official UML specification to see whether the code generator's behaviour is correct according to the spec.
Look at Digital Watch (nested) and at Tic Tac Toe. Check you understand the action and condition notations that they use.
(If time, else afterwards.)
UmpleOnline will show a diagram, but it doesn't look exactly like the one in the tutorial page: it doesn't show the entry, exit and do actions. The Umple code does include those, though: check you understand.
perdita@inf.ed.ac.uk
)
Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk Please contact our webadmin with any comments or corrections. Logging and Cookies Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh |