SDM: Week 2

Topic: Modelling; Relating (Java) code and (UML) models

Lectures

Modelling: slides and video Part 1, video Part 2

Week 2 Q&A/discussion - moved to the week 3 lab thanks to Storm Eowyn - the paleo example.  We discussed the sense in which the diagram at the end of the slides could be considered a model, and a software development setting in which it might be used: a start-up wanting to quickly roll out new apps to support each newly fashionable diet.  That is, we were thinking about how to develop a domain-specific modelling language to describe such diagrams. We identified some features of the paleo diagram that seemed to be bugs - ways in which we felt it violated the rules we would want to impose (e.g., multiple arrows labelled Yes or No coming out of the same question). We thought about what the concepts in the DSML would be and how they would be related. That is, we produced a metamodel for the DSML. A key move was to introduce the abstract Node class, to give us a neat way to represent that each question should have one yes arrow and one no arrow, but that each of these could go either to a result or to another question. Finally I invited you to think about whether there are other rules that diagrams in our DSML should obey, but which are not already encoded in our metamodel diagram. We'll talk about this some more on Friday.

 Here is the diagram we ended up with on the board. NB the red stuff at bottom left is a separate diagram - it's an object diagram, which I drew while we were discussing the multiplicity on the Question end of the associations between Question and Node, to illustrate that in the paleo diagram we started with, it was possible to have several questions linked to the same result.

whiteboard picture

 

Videos

Readings

About how UML can be used:


Technical UML stuff:

  • Read something on UML2 sequence diagrams: Ch10 of Using UML if you have it (I will not examine concurrency features), or this (you could stop reading at the heading Gate) or this but note slight syntax errors in these links:
    • lifeline headings, name : type, should not be underlined (they used to be in UML1, but that changed with UML2)
    • messages that cause an activation should go in at the very top of the activation bar,
    • and synchronous messages should be shown with filled in arrow heads.

         For exam the fragments I want you to be able to use are loop, alt and opt.

  • Read something on state diagrams, so that you understand them enough to read and write state diagrams that might involve nested regions, parallel regions and history states. There are many sources, e.g.
    • Robert C. Martin's (very old, but still good) article UML Finite State Machine Diagrams which you'll find near the bottom of this long page of articles (I'm failing to link directly to it, but you might find it interesting to browse other articles on this page anyway!) You may stop (if you wish) at Implbut it's worth browsing the article list anyway!). You may stop (if you wish) at Implementing ementing State Machines on p5. NB states are drawn in slightly the wrong shape (because the article is based on an earlier version of UML).
    • Chs 11 and 12 of Using UML (but NB this doesn't cover history nodes, which you do need to know).
  • Read something on activity diagrams, so that you understand how to read and write activity diagrams that might include decision and merge diamonds and fork and join nodes, initial, final and flow-final nodes. I won't examine you on object flows, exceptions or interruptible regions. Sources include:
    • this tutorial
    • Ch 11 of Using UML (though this doesn't mention flow-final nodes).
License
All rights reserved The University of Edinburgh