1 / 12

UML

UML. Grafical method to develop models Industry standard Different diagrams for different aspects Static diagrams: Classes Use case Deployment Dynamic diagrams Sequence State machine Running example: Observer Pattern (A = abstract, C = concrete). Class diagrams. Association.

katelynna
Download Presentation

UML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. UML • Grafical method to develop models • Industry standard • Different diagrams for different aspects • Static diagrams: • Classes • Use case • Deployment • Dynamic diagrams • Sequence • State machine • Running example: Observer Pattern (A = abstract, C = concrete)

  2. Class diagrams Association A class is represented by a box AObserver ASubject Class name 1 * observers: collection(AObserver) Attributes observers attach(AObserver) Methods detach(Aobserver) notify() $update() forall obs in observers obs.update()

  3. ASubject AObserver observers attach(AObserver) detach(Aobserver) notify() $update() Inheritance versus 1 * CSubject CObserver subject state: State state:State Mutual dependency! getState(): State setState(State) update()

  4. Composition Static ownership relation Owner creates object(s) at its own creation Object(s) disappears when owner disappears Aggregation Dynamic ownership relation Owner creates/destroys object(s) at any time CSubject Association Reference to an object owned by yet another object State getState(): State setState(State) Dependency component depends on component to which arrow points

  5. Stereotype <<interface>> Player methods Package Interface inheritance (realization) RealPlayer methods Do not include too many classes in one diagram (readability) – tools support that the same classes appear in different diagrams

  6. Sequence diagrams • Model dynamic behavior • Used to describe some sequence of method calls for important sequences (typical or complicated) • More general dynamic behavior is captured by state diagrams • Control of a single thread jumps from object to object when calls/returns are made

  7. (Outside) Actor :CObserver :CSubject attach(this) setState(state) update() notify() getState() state Notice that contol “jumps”: actor can be considered as a separate thread

  8. Object creation Call: object becomes active Return: object becomes inactive destroy()

  9. System name UC1 generalization UC1’ actor UC2 Extend/include UC3 Use Case

  10. State machines • General dynamic behavior of classes • In contrast to use cases that are for a typical scenario only, state machines describe behavior for all uses • State machines can send messages to other state machines and cause a transition there • With a state transition, there can be a trigger and an action • If there is no trigger, the transition is always made

  11. CObserver states …/subject.detach(this) /subject.attach(this) (Initial transition) detached attached free update()/ attach(this)/ updating waiting /state=subject.getState() updated usually some operations on state

  12. setState(state) CSubject states updated consistent /notify();n=0 n=|observers|/ /observers =Ø notifying attach(obs)/observers +=obs waiting getState()/n+=1 |observers| !=0/observers(n).update() updateObserver detach(obs)/observers -=obs

More Related