27 March UML Unified Modeling Language Software Engineering

  • Slides: 37
Download presentation
27 March UML: Unified Modeling Language

27 March UML: Unified Modeling Language

Software Engineering Elaborated Steps n n n n n Concept Requirements Architecture Design Implementation

Software Engineering Elaborated Steps n n n n n Concept Requirements Architecture Design Implementation Unit test Integration System test Maintenance

What is UML? n software blueprint language: common vocabulary n n n applicable to

What is UML? n software blueprint language: common vocabulary n n n applicable to object-oriented problem solving begins with the construction of a models consist of objects n n n for analysts, designers, and programmers not for the customer interact by sending messages attributes: things they know behaviors or operations: things they can do state Also used for business processes

Modeling Review n n Based on abstraction n looking only at relevant information n

Modeling Review n n Based on abstraction n looking only at relevant information n hiding details Multiple views n as orthogonal as possible n each view has information that n n n is unique appears in other views common information is consistent

Modeling Languages and Processes n Language: syntax n n n usually graphical used to

Modeling Languages and Processes n Language: syntax n n n usually graphical used to express design Process: steps to take to create a design Many processes, not a lot of agreement General consensus has built around UML as a language

UML History n Three well received models in early 90 s n n n

UML History n Three well received models in early 90 s n n n Grady Booch (Rational), Object Oriented Analysis and Design Jim Rumbaugh (GE), Object Modeling Technique Ivar Jacobson (Ericsson), Object Oriented Software Engineering By ’ 95, all three “amigos” were working for Rational (acquired by IBM in 2002) OMG adopted UML in ’ 97 n Version 2. 0 completed in 2004

OMG Model Oriented Architecture n n n UML - graphical language for visualizing, specifying,

OMG Model Oriented Architecture n n n UML - graphical language for visualizing, specifying, constructing, artifacts MOF - integration framework for metadata and data n Specification to translate MOF model to text artifacts n Query language n … CWM - semantic context for interchange of metadata

Why Study UML? n software engineering cultural literacy n natural model for design lots

Why Study UML? n software engineering cultural literacy n natural model for design lots of good tools n n useful tool Rational generates C++ and Java code Some people expect tools to generate code n n n good for prototyping good for development? Would this be good or bad?

What UML Is and Isn’t n n Syntax only Standardized Language and tool independent

What UML Is and Isn’t n n Syntax only Standardized Language and tool independent Generic enough to be n n n Extendable through “stereotypes” n n n Usable in lots of environments And leaving you lots of space to misuse it New symbols built up from basic ones Used to develop a business process model Not a process (there is a companion one)

References n n www. uml. org Fowler, UML Distilled, Addison-Wesley n n n 3

References n n www. uml. org Fowler, UML Distilled, Addison-Wesley n n n 3 rd edition, 2004, covers 2. 0 Short Good summary charts on inside covers

UML Views: Diagram Types n n n n n Use Case – outside view

UML Views: Diagram Types n n n n n Use Case – outside view (scenarios) Class – classes and relationships among them Object – instances instead of classes Sequence – how and when objects interact through messages Collaboration – how objects interact through roles Statechart – object behaviors as reflected through states (single class) Activity – flow diagram covering multiple classes and their interactions Component – analogous to class but for code module Deployment – physical configuration of system nodes and their communication

Component Use case Activity Deployment Class Object Statechart Collaboration Sequence

Component Use case Activity Deployment Class Object Statechart Collaboration Sequence

Classification of Diagram Types Diagram Use case Class Object Sequence Collaboration Statechart Activity Component

Classification of Diagram Types Diagram Use case Class Object Sequence Collaboration Statechart Activity Component Deployment Static/Dynamic Static Phase Requirements Design Dynamic Static Design Code Deploy

Use Case Diagram n n Defines the outside view Elements n n n Actors

Use Case Diagram n n Defines the outside view Elements n n n Actors (stick figures): anything outside the system that interacts with it Use cases (ovals): procedures by which the actor interacts with the system Solid lines: indicate how actors interact

Example of Use Case

Example of Use Case

Use Case Extensions n Dotted lines: show dependencies between procedures Includes (subroutine) n Extends

Use Case Extensions n Dotted lines: show dependencies between procedures Includes (subroutine) n Extends (variation) n

Example of Use Case

Example of Use Case

Example of Use Case (customer name)

Example of Use Case (customer name)

Use Case Usage n n n determining features (requirements) basis for communicating with clients

Use Case Usage n n n determining features (requirements) basis for communicating with clients generating test cases

Class Diagrams n n Static structure of the system. What interacts, but not what

Class Diagrams n n Static structure of the system. What interacts, but not what happens. Class notation is a rectangle divided into three parts n n n class name (abstract classes are in italics) attributes operations

Class Relationships n association n n relationship between instances of the two classes may

Class Relationships n association n n relationship between instances of the two classes may have a role name to clarify the nature of the association link connecting two classes navigability arrow shows which direction the association can be traversed or queried. Also shows ownership n n multiplicity of an association end is the number of possible instances of the class associated with a single instance of the other end n n n 0. . 1 n. . m 0. . * or * 1 1. . * zero or one instance n to m instances no limit on the number of instances (including none) exactly one instance at least one instance aggregation n No arrow means bidirectional association in which one class belongs to a collection diamond end pointing to the part containing the whole. generalization n inheritance link indicating one class is a superclass of the other

Class Diagram Example

Class Diagram Example

Object Diagrams object diagram: instantiates class diagram

Object Diagrams object diagram: instantiates class diagram

Sequence Diagram n n Interactions between objects Elements n Objects (oblong boxes or actors)

Sequence Diagram n n Interactions between objects Elements n Objects (oblong boxes or actors) n n Messages (solid lines for calls, dotted for replies): interactions between objects n n n Box implies creation May include iterations and conditions Object lifelines (dotted lines): life time of object Activation bar (vertical oblong box on lifeline): thread of control for synchronous systems

Example Sequence Diagram

Example Sequence Diagram

Collaboration Diagram n n Alternative to sequence diagram Loses timing information n Relative sequence

Collaboration Diagram n n Alternative to sequence diagram Loses timing information n Relative sequence may be added with order numbers Focus on object roles instead of the times that messages are sent Object roles are the vertices and messages are the connecting links

Example Collaboration Diagram

Example Collaboration Diagram

Statechart Diagram n n n Often used in real-time embedded systems Shows the order

Statechart Diagram n n n Often used in real-time embedded systems Shows the order in which incoming calls normally occur Elements n n n States (oblong boxes): stable states; includes actions in second segment Transitions (solid arrows): possible change states Events (text on arrow before /): event that causes the transition Conditions ([ ] after Event): qualifies event Actions (text on arrow after /)

Example of Statechart Diagram

Example of Statechart Diagram

Activity Diagram n n General purpose flowchart Elements n n n Active states (oblongs

Activity Diagram n n General purpose flowchart Elements n n n Active states (oblongs with rounded corners): what is done Transitions (arrows): represent a thread of activity. Conditions (in [ ] on transitions) Decisions (diamonds) Swimlanes (vertical lines the length of the diagram): allow activities to be assigned to objects. Synch States (solid lines) split or merge transitions

Example of Activity Diagram

Example of Activity Diagram

And… n Component Diagram n n software components, interfaces, and dependencies Deployment Diagram n

And… n Component Diagram n n software components, interfaces, and dependencies Deployment Diagram n Nodes, communication links, and components

Example of Component Diagram

Example of Component Diagram

Example of Deployment Diagram

Example of Deployment Diagram

Pitfalls of UML n can feel like you’ve accomplished more than design because there

Pitfalls of UML n can feel like you’ve accomplished more than design because there are tools and artifacts need to know when to stop designing n variant of analysis paralysis n

Symptoms of UML Fever (Bell, Queue, March 2005) n n n expecting more from

Symptoms of UML Fever (Bell, Queue, March 2005) n n n expecting more from UML than it was ever intended to do (performance, fault tolerance) taking UML to too detailed a level UML products become most of the milestones UML syntax discussions dominate design brainstorming sessions “if it can’t be described in UML, it’s not relevant” UML designed without user input

How would you use these different tools?

How would you use these different tools?