Beyond Code: An Introduction to Model-Driven Software Development (CISC 836, Winter 2020)
UML-RT Sample Models
Instructions on how to import these models into RSARTE can be found on the Assignment 1 page.
- PingPong 1:
- PingPong 2:
- attributes and choice points
- 'Pinger' uses 'exit()' (in transition to 'End'); for this to be possible 'Implementation Preface' of 'Pinger' (select 'Pinger' and under 'Properties' click 'C++ General') must contain '#include <stdlib.h>'
- PingPong 3:
- PingPong 4:
- command line arguments and random number generator
- to be able to use the functions 'rand()' and 'time()' from C++ library 'time.h', the 'Implementation Preface' of 'Pinger' (select 'Pinger' and under 'Properties' look for 'C++ General') must contain '#include <stdlib.h>' and '#include <time.h>'
- PingPong 5:
- illustates a client/server relationship: client sends two request 'inc(x)' and 'doub(x)' in alternating fashion; server responds with 'result(x)'
- PingPong 6:
- version of PingPong5 that illustrates the 'hidden state' anti-pattern: 'Client' keeps tranck of which message to send next via a flag ('waitingForInc')
- PingPong 7:
- composite states, group transitions, and timers
- PingPong 8:
- composite states, history (via transition 'timeout2' in 'Client'), unexpected messages (due to state 'Interupt' in 'Client')
- set attribure 'INTERRUPTS_ENABLED' in 'Client' to 'true'
- add transition 't' from 'Interrupt' to 'Error' with 'result' as trigger
- prevent 't' from ever being enabled by adding a guard that always evaluates to 'false'
- [PingPong 8 to PingPong 10.zip]
- PingPong 9
- sending messages with more than one parameter using a data class
- class 'Args' packages all parameters for message 'init' from 'Top' to 'Pinger'
- in 'Top' and 'Pinger', dependency to class 'Args' must be set with 'Kind In Header' set to 'none' and 'Kind in Implementation' set to 'inclusion'
- PingPong 10
- correct version of PingPong 8 using 'defer/recall'
- PingPong 11
- Multplicity 1
- port replication
- To set the multiplicity of a port 'p' to 'n..m', select 'p', then click 'Advanced' under 'Properties'. Find 'Lower' and 'Upper' and set them to 'n' and 'm', respectively. Setting the multiplicity of a capsule part is similar (select the part and set 'Lower' and 'Upper' under 'Properties' and 'Advanced'.
- [Multiplicity 1 to Multiplicity 2.zip]
- Multplicity 2
- port replication and capsule replication
- DeferRecall 1
- Version v0: the vast majority of the functionality is put into the effect of a transition; as a result, the state machine is simple, but the action code is complex and contains several loops
- Version v2: Changer state machine makes the 3 stages of the process (giving toonies, giving loonies, and checking for zero) visible; 'tick' messages necessary to advance the computation; Changer capsule does not contain any structure
- Version v3: Changer capsule contains three parts ('toonies', 'loonies', and 'zerocheck'), one for each of the states of the process