Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
Smalltalk and Object Orientation: an Introduction - Free
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
20.2.1.3 Prepare sequence <strong><strong>an</strong>d</strong> collaboration diagrams<br />
Once you have identified events within the system document them first as sequence diagrams <strong><strong>an</strong>d</strong> then<br />
as collaboration diagrams. This approach is easier, as sequence diagrams tend to deal with the<br />
sequential ordering of the events from one object to <strong>an</strong>other whereas a collaboration diagram may<br />
involve a number of objects.<br />
20.2.1.4 Build a state diagram<br />
A state diagra m should be constructed for each object class with nontrivial dynamic behavior. Every<br />
sequence diagram (<strong><strong>an</strong>d</strong> thus collaboration diagram) corresponds to a path through a state diagram. Each<br />
br<strong>an</strong>ch in control flow is represented by a state with more th<strong>an</strong> one exit tr<strong>an</strong>sition. The procedure for<br />
producing state diagrams as described by the OMT method, is summarized below by the following<br />
algorithm:<br />
1. Pick a class.<br />
2. Pick one sequence diagram involving that class.<br />
3. Follow the events for the class, the gaps in between the events are states. Give each state a name<br />
(if it is me<strong>an</strong>ingful to do so).<br />
4. Draw out a set of states <strong><strong>an</strong>d</strong> events linking states based on the sequence diagrams.<br />
5. Now find loops within the diagram. That is, repeated sequences of states.<br />
6. Chose <strong>an</strong>other sequence diagram for the class <strong><strong>an</strong>d</strong> produce the states <strong><strong>an</strong>d</strong> events for that diagram.<br />
Next merge these states <strong><strong>an</strong>d</strong> events into the first diagram. That is, find the states <strong><strong>an</strong>d</strong> events<br />
which are the same <strong><strong>an</strong>d</strong> find where they diverge. Now add the new events <strong><strong>an</strong>d</strong> states.<br />
7. Repeat step 6 for all sequence diagrams involving this class.<br />
8. Repeat from step 1 for all classes.<br />
After considering all normal events, add boundary cases <strong><strong>an</strong>d</strong> special cases. Also consider events which<br />
occur at awkward times including error events.<br />
You should now consider <strong>an</strong>y conditions on the tr<strong>an</strong>sitions between states <strong><strong>an</strong>d</strong> <strong>an</strong>y events which are<br />
triggered off by these tr<strong>an</strong>sitions. Note that we still have not really considered the operations which the<br />
system will perform.<br />
20.2.1.5 Match events between objects<br />
Having produced the state diagrams you should now check for completeness <strong><strong>an</strong>d</strong> consistency across the<br />
whole system. Every event should have a sender <strong><strong>an</strong>d</strong> a receiver, all states should have a predecessor <strong><strong>an</strong>d</strong><br />
a successor (even if they are start points or exit points) <strong><strong>an</strong>d</strong> every use case should have at least one state<br />
diagram which explains its effect on the system’s behavior. You should also make sure that events<br />
which are the same but on different state charts have the same name.<br />
20.2.2 Functional modeling<br />
The functional model in OMT describes how values are computed. UML does not possess <strong>an</strong>y notation<br />
for representing functional models <strong><strong>an</strong>d</strong> this reflects the lack of emphasis placed on functional model<br />
style <strong>an</strong>alysis by object oriented design methods. OMT uses Data Flow Diagrams (or DFD’s) to<br />
represent functional models. In essence the functional model explains how the operations (yet to be<br />
added) in the object model <strong><strong>an</strong>d</strong> the actions / activities of the dynamic model are achieved. It c<strong>an</strong> also be<br />
used to represent constraints amongst the values of the model.<br />
A DFD possesses inputs <strong><strong>an</strong>d</strong> outputs, data stores, processes <strong><strong>an</strong>d</strong> data flows (arrows). Figure 20.1<br />
illustrates <strong>an</strong> example DFD diagram.<br />
Data stores are passive objects which store data for later use. That is they merely respond to<br />
requests to store <strong><strong>an</strong>d</strong> access data. The Icon Definitions label between two parallel bars indicates a data<br />
store.<br />
Processes are drawn as <strong>an</strong> ellipse. They possess a fixed number of inputs <strong><strong>an</strong>d</strong> outputs which are<br />
labeled with their type or name. Processes may be nested <strong><strong>an</strong>d</strong> of arbitrary complexity <strong><strong>an</strong>d</strong> eventually<br />
reference atomic operations.<br />
163