Course Instructor: Aisha Azeem

Slides:



Advertisements
Similar presentations
Activity Diagrams in UML. Definition Activity diagrams represent the dynamics of the system. They are flow charts that are used to show the workflow of.
Advertisements

UML (Sequence Diagrams, Collaboration and State Chart Diagrams) Presentation By - SANDEEP REDDY CHEEDEPUDI (Student No: ) - VISHNU CHANDRADAS (Student.
Use Case Model. C-S 5462 Use case model describes what the user expects the system to do –functional requirements may describe only the functionalities.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 9 Slide 1 Appendix 3 Object-Oriented Analysis and Design.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
Software Engineering COMP 201
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Essentials of interaction diagrams Lecture 23 & 24.
C++ Training Datascope Lawrence D’Antonio Lecture 11 UML.
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
UML Notations Activity diagrams State diagrams Class diagrams Use-case diagrams.
SE-565 Software System Requirements More UML Diagrams.
1 Lab Beginning Analysis and Design 4 Completion of first version of use case diagram initiates the processes of analysis and design. 4 UML provides.
Unified Modeling Language
Coming up: Interaction Diagrams
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour.
SOFTWARE ENGINEERING BIT-8 APRIL, 16,2008 Introduction to UML.
CS 360 Lecture 6.  A model is a simplification of reality  We build models to better understand the system being developed.  We build models of complex.
Lecture 7 Object Oriented Design. Outline  What is UML and why we use UML?  How to use UML diagrams to design software system?  What UML Modeling tools.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Faculty of Computer & Information Software Engineering Third year
Copyright 2002 Prentice-Hall, Inc. Chapter 2 Object-Oriented Analysis and Design Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey.
Requirements as Usecases Capturing the REQUIREMENT ANALYSIS DESIGN IMPLEMENTATION TEST.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Class diagram Used for describing structure and behaviour in the use cases Provide a conceptual model of the system in terms of entities and their relationships.
7 Systems Analysis and Design in a Changing World, Fifth Edition.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
An Introduction to the Unified Modeling Language
1 System Analysis and Design Using UML INSTRUCTOR: Jesmin Akhter Lecturer, IIT, JU.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
1 The Unified Modeling Language. 2 The Unified Modeling Language (UML) is a standard language for writing software blueprints. The UML may be used to.
Class Diagram. Classes Software Design (UML) Class Name attributes operations A class is a description of a set of objects that share the same attributes,
SWT - Diagrammatics Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000.
Design Model Lecture p6 T120B pavasario sem.
UNIFIED MODELING LANGUAGE(UML) BY Touseef Tahir Lecturer CS COMSATS Institute of Information Technology, Lahore.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
Scenario A scenario is a sequence of steps describing an interaction between a user and a system. Use case is a set of scenarios tied together by a common.
Systems Analysis and Design in a Changing World, Fourth Edition
Class Diagram Chapter 21 Applying UML and Patterns Craig Larman.
Coming up: Interaction Diagrams Sequence Diagrams Dan Fleck.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
UML (Unified Modeling Language)
Chapter 3: Introducing the UML
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
Use Case Diagrams. Introduction In the previous Lecture, you saw a brief review of the nine UML diagrams. Now that you have the clear, you'll start to.
Chapter 3: Software Design –Use case Diagram Nouf Alghanmi.
1 After the scenarios are formulated Find all the use cases in the scenario Describe each of these use cases in more detail Participating actors Describe.
System modeling and the Unified Modeling Language (UML) CS
Systems Analysis and Design in a Changing World, Fourth Edition
CHAPTER
UML-Class Diagrams. UML-Class Diagrams Order placement problem A Company has two types of customers, corporate customers and personal customers. All.
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Object-Oriented Analysis and Design
Use Case Model.
Unified Modeling Language
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Business System Development
Introduction to UML Introduction to UML Shiyuan Jin September,23,2002
Week 12: Activity & Sequence Diagrams
UML Class Diagram.
Object Oriented Analysis and Design
CIS 375 Bruce R. Maxim UM-Dearborn
BPMN - Business Process Modeling Notations
Use Case Model Use case diagram – Part 2.
Software Engineering System Modeling Chapter 5 (Part 1) Dr.Doaa Sami
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
CSE470 Software Engineering UML Lecture.  UML resource page
CIS 375 Bruce R. Maxim UM-Dearborn
Presentation transcript:

Course Instructor: Aisha Azeem Introduction to UML Course Instructor: Aisha Azeem

Introduction UML stands for Unified Modeling Language. It is a standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems. Specifying Visualizing Constructing Documenting Business Modeling Communications

UML Building Blocks Class: Class represents set of objects having similar responsibilities. Use case: Use case represents a set of actions performed by a system for a specific goal. Interaction: Interaction is defined as a behavior that consists of a group of messages exchanged among elements to accomplish a specific task.

Cont . . . State machine: State machine is useful when the state of an object in its life cycle is important. It defines the sequence of states an object goes through in response to events. Events are external factors responsible for state change. Note: A note is used to render comments, constraints etc of an UML element.

Cont . . . Generalization: Aggregation: Composition: Generalization can be defined as a relationship which connects a specialized element with a generalized element. It basically describes inheritance relationship in the world of objects. Aggregation: Whole part relationship i.e. large part “whole” contains one or more parts. E.g. building “whole” contains rooms ”parts” Composition: Is a relationship in which if the “whole” part dies, the child has to die as well. E.g. if building collapse , rooms no more exist

UML Models, Views, Diagrams UML is a multi-diagrammatic language Each diagram is a view into a model Diagram presented from the aspect of a particular stakeholder Provides a partial representation of the system Is semantically consistent with other views Example views

Models, Views, Diagrams

  UML Diagrams UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are used to make a complete UML diagram and the diagram represents a system. UML includes the following nine diagrams Class diagram Object diagram Use case diagram Sequence diagram Collaboration diagram Activity diagram State chart diagram Deployment diagram Component diagram

UML Modeling Types Different diagrams are used for different type of UML modeling. There are three important type of UML modeling : Structural modeling: Structural modeling captures the static features of a system. They consist of the followings: Class diagrams , Objects diagrams , Deployment diagrams , Component diagram etc Structural model represents the framework for the system and this framework is the place where all other components exist. They all represent the elements and the mechanism to assemble them. E.g. class written once remain same through out the execution.

Cont . . . Behavioral Modeling: Behavioral model describes the interaction in the system. It represents the interaction among the structural diagrams. Behavioral modeling shows the dynamic nature of the system Activity diagrams , Interaction diagrams, Use case diagrams Depends upon the behavior of an object/entity object can have more then one state, and depending upon its state its behavior would be different. E.g. bank account may be working(deposit/ withdraw) Not working(closed/ dead)

Cont . . . Dynamic Modeling: The dynamic model is used to express and model the behavior of the system over time. It includes support for activity diagrams, state diagrams, sequence diagrams e.g. user login(id, password), valid tries to login , its set of sequences will be different as compared to an invalid user. 

Use-Case Diagram Use Case Diagram is used to describe the functionalities provided by a system and the users associated with that system. The Use case diagram is used to identify the primary elements and processes that form the system. The primary elements are termed as "actors" and the processes are called "use cases." The Use case diagram shows which actors interact with each use case.

Use-Case Diagram The main purpose of the use-case diagram is: to help development teams visualize the functional requirements of a system To help identify relationship of "actors" (human beings who will interact with the system) with essential processes and understand the relationships among different use cases

Elements of a use-case diagram Use-case diagrams contain the following elements: Actors, which represent users of a system, including human users and other systems. Use Cases, which represent functionality or services provided by a system to users.

UML notation used to represent an actor Definition: The outside entity which communicates with the system: A Person (user) An external system Physical Environment An Actor has a unique name and an optional description Symbol: UML notation used to represent an actor

Actor (Example) Consider the following scenario related to a “University Management System” : In a university management system, a Student can submit the assignments, the instructor marks those assignments and then uploads the result. The Student is allowed to view the Results. Now, by recalling the definition of actor, can you identify the actors in this System? Student Instructor

Actor (Example/2) Student Instructor Student is an external entity which interacts with the system. Student is a user of this system, as some services are used by it. Instructor is another external entity which interacts with the university management system. Student Instructor

Use-case Represent functionality or services provided by a system to users. It is a description of set of sequence of actions that a system perform that produces an observable result. A use case represents a class of functionality provided by the system as an event flow. Use cases describe the interaction between a primary actor and the system itself

UML notation used to represent a use-case The use case technique is used in software and systems engineering to capture the functional requirements of a system. Each use case describes how the actor will interact with the system to achieve a specific goal. One or more scenarios may be generated from each use case, corresponding to the detail of each possible way of achieving that goal. Symbol : UML notation used to represent a use-case

Use-case (Example) Consider the same example again: In a university management system, a Student can submit the assignments, the instructor marks those assignments and then uploads the result. The Student is allowed to view the Results. Now, by recalling the definition of use-case, can you identify the use-cases in this System? Submit Assignments Mark Assignments Upload Results View Results

Use-case (Example/2) The use-cases are linked with the functional requirements of this system. In this example : Student submit the assignments. Instructor marks the assignments. Instructor upload the marks. Student can view the marks. It is now clear that how actors are interacting with different use-cases of this system. Now, lets combine actors and use-cases in one diagram?

Symbols in Use-Case Diagrams ACTOR USE-CASE INTERACTION: denotes set of messages exchanged among objects NOTES/COMMENTS

Use-Case Diagram (University Management System) SYSTEM BOUNDARY Submit Assignments Mark Assignments Student Upload Results View Results Instructor Package: University Management System

Cont . . . Other types of associations and relationships; Generalization between use cases Generalization between actors Include relationship between use cases Extend relationship between use cases

Generalization between Use cases Represented by a line and a hollow arrow From child to parent A use case generalization shows that one use case is simply a special kind of another. A child can be substituted for its parent whenever necessary. Generalization appears as a line with a triangular arrow head toward the parent use case Child use case Parent use case

Example Example : ATM Register car sharer CarMatch Administrator Web Server Register car sharer Transfer car sharer from web server Manually add car sharer Example : ATM

Generalization between Actors (examples) student Foreign student Local student

Include relationship between use cases Some times one use case includes the functionality of another use case. Include relationship is drawn as an open arrow with dashed lines that points towards the use case that is being included The word include is written in << . . . . . . >> Or If x is a task and y is a sub task but acting as a part of it then use <<include >> stereotype Arrowhead towards the subtask

Example

Extend relationship between use cases There are occasions where one use case may optionally be extended by the functionality in another use case. The relationship is drawn as an open arrow with dashed line the points towards the use case that is being extended. The word extend is written in <<……..>> Or If x is a task and y is a sub task of x but little bit different Arrow head towards the main task

Example Driver Passenger Purchase Ticket TimeOut NoChange OutOfOrder Turn left Turn right Take turn <<extends>> Driver Passenger Purchase Ticket TimeOut <<extends>> NoChange OutOfOrder Cancel

Practice Read the following case : Identify the actors Identify (extract ) the use cases Construct a proper use-case diagram (with proper symbols & notations)

Case-Study Consider the Library Management System of UOW. A Student is allowed to issue books for a period of two weeks. Student can read newspapers/magazines in the library and can even access the databases for e-books. The Library Staff is responsible for maintaining the records of students and along with the issued books. The Staff marks an entry in the register whenever a student issue or return a book. A fine is charged on a student if he/she fail to return the book on time. The Librarian is there to manage the staff, check the records and prepare reports for DG/DEAN.

Class diagrams Gives a graphical representation of domain model. It represents relationship of classes objects with object specification in detail. It gives static view of the system Each class is represented by a rectangle subdivided into three compartments Name Attributes Operations

Class Diagram: Visibilities Modifiers are used to indicate visibility of attributes and operations. ‘+’ is used to denote Public visibility (everyone) ‘#’ is used to denote Protected visibility (derived) ‘-’ is used to denote Private visibility (no one) By default, attributes are hidden and operations are visible. The last two compartments may be omitted to simplify the class diagrams

An example of Class Account_Name - Custom_Name - Balance Name +AddFunds( ) +WithDraw( ) +Transfer( ) Name Attributes Operations

Other representations of class Boeing 737 Boeing 737 length: meter fuelCapacity: Gal doors: int lift ( ) roll ( ) thrust ( ) Boeing 737 length: meter fuelCapacity: Gal doors: int Boeing 737 lift() roll()

Class Attributes (Cont’d) Person Attributes are usually listed in the form: attributeName : Type A derived attribute is one that can be computed from other attributes, but doesn’t actually exist. For example, a Person’s age can be computed from his birth date. A derived attribute is designated by a preceding ‘/’ as in: / age : Date name : String address : Address birthdate : Date / age : Date ssn : Id

Class Attributes (Cont’d) Person + name : String # address : Address # birthdate : Date / age : Date - ssn : Id Attributes can be: + public # protected - private / derived

Class Diagram: Association Associations represent relationships between instances of classes . An association is a link connecting two classes. Bi-directional association Associations are assumed to be bi-directional Uni-directional association e.g. Bank Account and person BankAccount Person BankAccount Person

Association: Multiplicity and Roles Instructor Student 1..* learns from teaches Multiplicity Symbol Meaning 1 One and only one 0..1 Zero or one M..N From M to N (natural language) * From zero to any positive integer 0..* From zero to any positive integer 1..* From one to any positive integer Note: if no multiplicity is given it is assumed to be 1 Association name: represents nature of participants classes in a relationship. Association Role: role played by the participant class

Notation of Class Diagram: Generalization Student TeachingAssistant Employee Subtype2 Supertype Subtype1 Person Student Generalization expresses a relationship among related classes. It is a class that includes its subclasses.

Cont . . . Separate target style Shared target style Vehicle Bus Truck Car Boeing 737 BoeingAirplane Boeing 757 Boeing 767 Shared target style Separate target style

Notation of Class Diagram: Composition Class W Class P1 Class P2 COMPOSITION Whole Class Part Classes Automobile Engine windows Example Composition: expresses a relationship among instances of related classes. It is a specific kind of Whole-Part relationship. It expresses a relationship where an instance of the Whole-class has the responsibility to create and initialize instances of each Part-class. Composition should also be used to express relationship where instances of the Whole-class have exclusive access to and control of instances of the Part-classes.

Cont . . . Car 4 Wheel Light Door Engine 4, 10 2, 5 1

Notation of Class Diagram: Aggregation Aggregation: expresses a relationship among instances of related classes. It is a specific kind of Container-Containee relationship. It expresses a relationship where an instance of the Container-class has the responsibility to hold and maintain instances of each Containee-class Aggregation is appropriate when Container and Containees have no special access privileges to each other. Class C Class E1 Class E2 AGGREGATION Container Class Containee Classes Bag Apples Milk Example

Cont. . . Player class Team 1 * Consists Of

Aggregation vs. Composition Composition is really a strong form of aggregation components have only one owner components cannot exist independent of their owner; both have coincident lifetimes components live or die with their owner e.g. (1)Each car has an engine that can not be share with other car (2) If the polygon is destroyed, so are the points. Aggregations may form "part of" the aggregate, but may not be essential to it. They may also exist independent of the aggregate. Less rigorous than a composition e.g. (1)Apples may exist independent of the bag. (2)An order is made up of several products, but the products are still there even if an order is cancelled.

Class Diagram example class * Multiplicity: mandatory Association Order -dateReceived -isPrepaid -number :String -price : Money +dispatch() +close() Customer -name -address +creditRating() : String() Corporate Customer -contactName -creditRating -creditLimit +remind() +billForMonth(Integer) Personal Customer -creditCard# OrderLine -quantity: Integer -price: Money -isSatisfied: Boolean Product * 1 Employee 0..1 Operations Attributes Name Association Multiplicity: mandatory Multiplicity: Many value Multiplicity: optional Generalization class

Interaction Diagrams In object oriented systems, tasks are performed by objects interacting with other by passing messages. In UML this interaction is provided by sequence diagrams. Class diagrams model static nature of system Interactions diagrams model the dynamic nature of system and emphasis the order of the message over time

Cont . . . squares with object type, optionally preceded by object name and colon

Purpose of interaction diagrams These are used to model : high level interaction between active objects in system Interaction between objects involved in a use case Interaction between objects involved in an operation Generic interactions (showing all possible paths through interaction)

Sequence Diagram Shows how objects communicate with each other over time. That is, sequence diagrams are used to model object interactions arranged in time sequence and to distribute use case behavior to classes. They can also be used to illustrate all the paths a particular use case can ultimately produce. The sequence diagram consists of Active Objects, Messages represented as solid-line arrows, and Time represented as a vertical progression.

Sequence Diagram - Objects A life line illustrates what is happening to an object in a chronological fashion. :Name Life line Activation(focus of control) Object

Sequence Diagram – Time & Messages Messages are used to illustrate communication between different active objects of a sequence diagram. :Name1 :Name2 Message Two Actor Message One

Types of Messages Synchronous (flow interrupt until the message has completed. 1st object waits until the 2nd object completes its operations Asynchronous (don’t wait for response) 1st object does not wait for the 2nd object to completes its operations Flat – no distinction between sysn/async Return – control flow has returned to the caller.

Steps in drawing a sequence diagram 1.Decide the context of the interaction System, subsystem, use case or operation 2. Identify the structural elements(objects) necessary to carry our functionality of use case 3. Consider alternative scenario that may be required 4. Draw the sequence diagram Layout the objects from left to right Starting with the message that starts the interaction Add focus of control Add timing constructs

Sequence Diagram – Compilation :Compiler Linker Actor Compile FileSystem Load Files Save OBJ Files Compile files Link Load OBJ files Link OBJ files Write EXE file

Example :making phone call Caller Phone Recipient Picks up Dial tone Dial Ring notification Ring Hello

Task 1 Draw a sequence diagram for: In Beauty and the Beast kitchen items came to life. Draw a sequence diagram for making a peanut butter and jelly sandwich if the following objects are alive: knife, peanut butter jar (and peanut butter), jelly jar (and jelly), bread, plate. I may or may not want the crusts cut off. Don’t forget to open and close things like the jars, and put yourself away, cleanup, etc…

Task 2 Draw a sequence diagram showing a customer’s interaction to withdraw money from ATM . Show all sequence of steps involved e.g. insert card, enter pin number , amount etc.

Activity diagrams Purpose of Activity diagrams is listed as under : Are a means of describing workflows Can be used as an analysis tool to describe business flows in different level of detail Describe complex flows within or between use case At design level, it can be use to describe flow within an operation.

Cont . . . Activity diagram consists of: Activities States transitions

Notations An activity is a unit of work that needs to be carried out symbol used to represent an activity Each activity can be followed by another activity (sequencing). Activity name

Triggering an activity There are four ways in which an activity can be triggered On Entry: these actions are triggered as soon as the activity starts Do: these actions take place during the life time of the activity On Event: these actions take place in response to an event On Exit: these actions takes place just before the activity completes

Cont . . . Actions -> is triggering of an event Activity name Entry/ action Do/action Event name/action Exit/action

States & Activities A state in an activity diagram is a point where some event needs to take place before activity continues Activities & states are roughly equivalent and states can carry out actions just as an activity can. However activities need to complete all their actions before exiting normally. States are used to imply waiting, not doing Wait for payment

Cont . . . There are two special states: Start State: is the entry point to a flow Only one start state is allowed in an diagram Shows as a block dot and is labeled End State: are drawn as black dots with a surrounding circle

Transition Transition : Is the movement from one activity to another The change from one state to another The movement between states and an activity in either direction. A transition normally occurs when all the actions of an activity have been completed. Or when an event triggers the exit from a particular state or activity. Are shown as arrowed lined between two activity Wait for payment Request payment

Cont . . . There are two types of transitions: Trigger-less transitions: are permissible when exiting activities, and meaning is that the activity has completed all its actions and next phase of workflow can begin Triggered Transitions: when exiting a state, some event needs to trigger it. E.g. when waiting for payment, exit from the state could be triggered by a PaymentArrives event Wait for payment Request payment PaymentArrives

Cont . . . There can be more than one transition out of a single activity or a state. This is used when different events results in a state or activity termination Wait for payment Chase payment Process payment PaymentPeriodExpires PaymentArrives (amount)

Decision Points A decision points in a workflow where the exit transition from a state or an activity may branch in alternative direction Depending on a condition Represented by a diamond.

Synchronisation bar Synchronisation bar. All triggers from this attach to activities that can occur in parallel, with no specific sequence, or concurrently. Symbol or

Example Process payment Update cash balance Process Cheque Clear Debt Cheque payment Cash payment Clear Debt

Activity Diagrams - Notation Start at the top black circle If condition 1 is TRUE, go right; if condition 2 is TRUE, go down At first bar (a synchronization bar), break apart to follow 2 parallel paths At second bar, come together to proceed only when both parallel activities are done

Example

Example 2

Creating an activity diagram Modelling a workflow in an activity diagram Identify a workflow objective. Decide the pre and post-conditions of the workflow. Define all activities and states. Define any objects that are created or modified. Decide on responsibility for performing the activities. Connect all elements on the diagram with transitions. Place decisions on the diagram. Evaluate your diagram for concurrent workflows. Set all actions, triggers and guard conditions in the specifications of each model element.

Task Draw an activity diagram to issue book from library

Possible solution