The previous chapter presented the structural elements defined within the UML things like classes, objects, interfaces, ports, subsystems, and components and how structural views of the system could be constructed from assemblies of these elements. The other pillar of object-oriented modeling is the specification of dynamic behavior. Behavior binds the structure of objects with their attributes and relationships so that objects can meet their responsibilities. Ultimately, actions implement an object's behavior, and the UML provides several approaches for linking action executions. One approach is to put the actions in the methods of classes, and the invocation of these actions takes place using the normal rules of the implementation action language. Common action languages are C, C++, Java, and Ada. Another approach for constraining these primitive actions into permissible sequences is through the use of activity diagrams a generalized kind of flowchart that allows us to specify action execution, branching, looping, concurrency, and so on. The last primary facility in the UML for specifying action sequences is with state machines, especially when the object is "reactive," that is, its behavior is executed in response to received events. This chapter discusses these concepts in some detail. The behavioral specification approach defines the behavior of individual elements (Classifiers). We must also concern ourselves with collaborative behavior that is, behavior of collections of instances that work together to achieve a common, higher-level purpose, such as the realization of a use case. We model the behaviors of collaborations using interactions. Such interactions may be completely synchronous, relying on method calls, completely asynchronous, using various message-queuing schemes, or a combination of the two. The UML uses interaction diagrams such as sequence, collaboration, and timing diagrams to capture and represent interactions. Additionally, activity diagrams, with activities bound to swim lanes, may also specify interactions among objects represented by those swim lanes. |