Page 315 -
P. 315

282     Part 3  •  the analysis Process

                                           2. Synchronous messages, which are calls to functions or subroutines. The calling object
                                             stops and waits for control to be returned to it, along with an optional message.
                                           3. Temporal events, which occur at a predetermined time. These usually do not involve an
                                             actor or any external event.
                                             Material objects have persistence; that is, they exist for a long period of time. Airplane flights,
                                         concerts, and sporting events have shorter persistence (they may have states that transition in a shorter
                                         time). Some objects, called transient objects, do not survive the end of a session. These include main
                                         memory, Web URL (or location) data, web pages, CICS displays, and so on. The only way to save
                                         transient objects is to store information about them, such as storing Web data in a cookie.
                                             Each time an object changes state, some of the attributes change their values. Furthermore,
                                         each time an object’s attributes change, there must be a method to change the attributes. Each of the
                                         methods would need a display or Web form to add or change the attributes. These become the inter-
                                         face objects. The display or Web form would often have more controls (or fields) on them than just
                                         the attributes that change. They would usually have primary keys, identifying information (such as
                                         a name or address), and other attributes that are needed for a good user interface. The exception is a
                                         temporal event, which may use database tables or a queue containing the information.

                                         A State Transition Example
                                         Consider a student enrolling at a university and the various states that he or she would go through.
                                         Three of the states are listed below in detail:

                                                     State:                      Potential Student
                                                     Event:                      Application Submitted
                                                     Method:                     new( )
                                                     Attributes changed:         Number
                                                                                 Name
                                                                                 Address
                                                     User interface:             Student Application Web Form
                                                     State:                      Accepted Student
                                                     Event:                      Requirements Met
                                                     Method:                     acceptStudent( )
                                                     Attributes changed:         Admission Date
                                                                                 Student Status
                                                                                 Return Acceptance Letter
                                                     User interface:             Accept Student Display
                                                     State:                      Dorm Assigned Student
                                                     Event:                      Dorm Selected
                                                     Method:                     assignDorm( )
                                                     Attributes changed:         Dorm Name
                                                                                 Dorm Room
                                                                                 Meal Plan
                                                     User interface:             Assign Student Dorm Display


                                             The other states are  Program Student, Current Student, Continuing Student, and
                                         Graduated Student. Each state would have an event, methods, attributes changed, and a user
                                         interface associated with it. This series of states can be used to determine the attributes and meth-
                                         ods that make up part of the class.
                                             The states and events that trigger the changes may be represented on a statechart diagram
                                         (or a state transition diagram). The statechart diagram for Student is illustrated in Figure 10.22.
                                         States are represented by rectangles, and events or activities are the arrows that link the states
                                         and cause one state to change to another state. Transition events are named in the past tense
                                         because they have already occurred to create the transition.
   310   311   312   313   314   315   316   317   318   319   320