Module 7
Generalization/Specialization
Abstract class— a class that allow subclasses to inherit characteristics but never gets instantiated. In Italics (Sale) Concrete class— a class that can have instances • Inheritance - Attributes of OnlineSale are: - timeOnSite,
Concurrent paths
Concurrent paths often shown by synchronization bars (same as Activity Diagram) • Multiple exits from a state is an "OR" condition. • Multiple exits from a synchronization bar is an "AND" condition.
Concurrency in a State Machine Diagram
Concurrent states - when an object is in one or more states at the same time Path - a sequential set of connected states and transitions Concurrent paths - when multiple paths are being followed concurrently, i.e. when one or more states in one path are parallel to states in another path
relationships in class diagrams
- Association Relationships • These are associations discussed previously, just like ERD relationships - Whole Part Relationships • One class is a component or part of another class - Generalizations/Specialization Relationships • Inheritance Try not to confuse relationship with association
The State Machine Diagram Object Behaviour and States
Each class has objects that may have status conditions or "states" • Object behavior consists of the various states and the movement between these states • State - a condition during an object's life when it satisfies some criterion, performs an action, or waits for an event • Transition - the movement of an object from one state to another
More Complex Issues about Classes: Generalization/Specialization Relationships
Generalization/Specialization - A hierarchical relationship where subordinate classes are special types of the superior classes. Often called an Inheritance Hierarchy • Superclass - the superior or more general class in a generalization/specialization hierarchy Subclass - the subordinate or more specialized class in a generalization/specialization hierarchy • Inheritance - the concept that subclasses classes inherit characteristics of the more general superclass
Steps in Creating a State Machine Diagram
Review the class diagram (in our case, conceptual object model) and select object classes that might require state machine diagrams 2. For each object class, make a list of status conditions (states) you can identify 3. Begin building diagram fragments by identifying transitions that cause an object to leave the identified state 4. Sequence these states in the correct order and aggregate combinations into larger fragments 5. Review paths and look for independent, concurrent paths 6. Look for additional transitions and test both directions 7. Expand each transition with appropriate message event, guard condition, and action expression 8. Review and test the state machine diagram for the object class - Make sure state are really state for the object in the class - Follow the life cycle of an object coming into existence and being deleted - Be sure the diagram covers all exception condition - Look again for concurrent paths and composite states
State Machine Diagram
State Machine Diagram - a diagram which shows the life of an object in states and transitions • Origin state - the original state of an object before it begins a transition Destination state - the state to which an object moves after completing a transition • pseudostate - the starting point in a state machine diagram. Noted by a black circle • action-expression - some activity that must be completed as part of a transition • guard-condition - a true/false test to see whether a transition can fire
More Complex Issues about Classes: Whole Part Relationships
Whole-part relationship— a relationship between classes where one class is part of or a component portion of another class Aggregation— a whole part relationship where the component part exists separately and can be removed and replaced (UML diamond symbol on next slide, ) - Computer has disk storage devices (storage devices exist apart from computer) - Car has wheels (wheels can be removed and still be wheels) Composition— a whole part relationship where the parts cannot be removed (filled in diamond symbol, ) - OrderItem on an Order (without the Order, there are no OrderIterms) - Chip has circuits (without the chip, there are no circuits)