SEEM4570 System Design and Implementation. Lecture 10 UML

Similar documents
SEEM4570 System Design and Implementation Lecture 11 UML

Notation Part 1. Object Orientated Analysis and Design. Benjamin Kenwright

Software Service Engineering

Practical UML - A Hands-On Introduction for Developers

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

SEEM4570 System Design and Implementation. Lecture 11 From Design to Implementation

CS 370 REVIEW: UML Diagrams D R. M I C H A E L J. R E A L E F A L L

Practical UML : A Hands-On Introduction for Developers

UML Fundamental. OutLine. NetFusion Tech. Co., Ltd. Jack Lee. Use-case diagram Class diagram Sequence diagram

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

COSC 3351 Software Design. An Introduction to UML (I)

Unified Modeling Language (UML)

Software Life-Cycle Models

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

UNIT-4 Behavioral Diagrams

Lab Manual. Object Oriented Analysis And Design. TE(Computer) VI semester

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

UML Tutorial. Unified Modeling Language UML Tutorial

CHAPTER 5 CO:-Sketch component diagram using basic notations 5.1 Component Diagram (4M) Sample Component Diagram 5.2 Deployment Diagram (8M)

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Unified Modeling Language I.

Object-Oriented Software Engineering Practical Software Development using UML and Java

UML. By Somenath Mukhopadhyay.

Computer Science for Engineers

INTRODUCTION TO UNIFIED MODELING MODEL (UML) & DFD. Slides by: Shree Jaswal

Software Engineering Lab Manual

Object-Oriented and Classical Software Engineering

Object-Oriented Systems Analysis and Design Using UML

Question Sheet There are a number of criticisms to UML. List a number of these criticisms.

Object-Oriented Design

UML 2.0 UML 2.0. Scott Uk-Jin Lee. Division of Computer Science, College of Computing Hanyang University ERICA Campus

CSI 32. Lecture Object-Oriented Paradigm. UML (Unified Modeling Language)

Unified Modeling Language (UML)

Object Oriented Modeling and Design

Ali Khan < Project Name > Design Document. Version 1.0. Group Id: S1. Supervisor Name: Sir.

What is a Class Diagram? A diagram that shows a set of classes, interfaces, and collaborations and their relationships

What is a Class Diagram? Class Diagram. Why do we need Class Diagram? Class - Notation. Class - Semantic 04/11/51

Unified Modeling Language

Oral Questions. Unit-1 Concepts. Oral Question/Assignment/Gate Question with Answer

UML Primer. -Elango Sundaram

Meltem Özturan

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

OO Techniques & UML Class Diagrams

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

UML diagrams. Software artifacts include: SRS, SDS, test cases, source code, technical/user manual, software architecture, etc.

Today s Topic. Lecture 5. What is UML? Why Use UML. UML Diagrams. Introduction to UML. What is UML Why use UML? UML Diagrams

1/17/2014. UML Help and Details (from: UML for cse UML for a class. UML and project clarifications

Vidyalankar. T.Y. Diploma : Sem. VI [IF/CM] Object Oriented Modeling and Design Prelim Question Paper Solution

CHAPTER 1. Topic: UML Overview. CHAPTER 1: Topic 1. Topic: UML Overview

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

Interactions A link message

UNIT-IV BASIC BEHAVIORAL MODELING-I

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

UNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?

UNIT 5 - UML STATE DIAGRAMS AND MODELING

Object Orientated Analysis and Design. Benjamin Kenwright

Unified Modeling Language

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Software Development Cycle. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language. Unified Modeling Language.

Today s Agenda UML. CompSci 280 S Introduction to Software Development. 1.Introduction UML Diagrams. Topics: Reading:

Course 3 7 March

Chapter 2: Entity-Relationship Model

Lecture 34 SDLC Phases and UML Diagrams

INF 111 / CSE 121: Announcements Quiz #3- Thursday What will it cover?

Introduction. Chapter 1. What Is Visual Modeling? The Triangle for Success. The Role of Notation. History of the UML. The Role of Process

Activity Diagram Written Date : September 02, 2016

Experiment no 4 Study of Class Diagram in Rational Rose

BPMN Getting Started Guide

Modeling with UML. (1) Use Case Diagram. (2) Class Diagram. (3) Interaction Diagram. (4) State Diagram

IDERA ER/Studio Software Architect Evaluation Guide. Version 16.5/2016+ Published February 2017

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

Introducing the UML Eng. Mohammed T. Abo Alroos

OO System Models Static Views

MSO Analysis & UML. Hans Philippi (based on the course slides of Wouter Swierstra) August 24, Analysis & UML 1 / 56

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

IS 0020 Program Design and Software Tools

Selection of UML Models for Test Case Generation: A Discussion on Techniques to Generate Test Cases

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

Topic 3 Unified Modeling Language UML. Objective: Student will use UML to represent relationshiops between objects, its structure and dynamics.

CISC 322 Software Architecture

UNIT-II Introduction to UML

UML: Unified Modeling Language

Object-Oriented Analysis and Design. Pre-UML Situation. The Unified Modeling Language. Unification Efforts

Interaction Modelling: Sequence Diagrams

VISHNU INSTITUTE OF TECHNOLOGY Vishnupur, BHIMAVARAM

OBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization

LABORATORY 1 REVISION

Index. : (colon), 80 <<>> (guillemets), 34, 56

Object-Oriented Development and UML. Announcement. Agenda 7/3/2008. Class will resume on July 22. Try to complete the lab assignments by July.

Accessibility. EEC 521: Software Engineering. Classes and Objects. Inheritance. Classes and Objects (OO Analysis)

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Object Oriented Design. Program Design. Analysis Phase. Part 2. Analysis Design Implementation. Functional Specification

UML- a Brief Look UML and the Process

Object-Oriented Systems Development: Using the Unified Modeling Language

Principles of Software Construction: Objects, Design and Concurrency. Just enough UML. toad

Unified Modeling Language (UML)

Transcription:

SEEM4570 System Design and Implementation Lecture 10 UML

Introduction In the previous lecture, we talked about software development life cycle in a conceptual level E.g. we need to write documents, diagrams, etc. But how to write/draw them? 2017. Gabriel Fung. 2

UML (1) Unified Modeling Language (UML) is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created, by OMG. OMG Object Management Group a consortium. UML provides specifications but not implementation. Before a specification can be accepted as a standard by OMG, the team which propose the specification must guarantee they can use the specification to bring a product to a market within 1 year. This prevents un-implementable standard. UML was in the list of OMG adopted technologies in 1997, and also the industry standard for modeling softwareintensive systems. 2017. Gabriel Fung. 3

Side Track About Consortium A consortium is an association of two or more individuals, companies, organizations or governments (or any combination of these entities) with the objective of participating in a common activity or pooling their resources for achieving a common goal. Consortium is a Latin word, meaning "partnership", "association" or "society" Con = "together" Sors = "fate" Consors = "Partner" 2017. Gabriel Fung. 4

UML (2) UML is used to specify, visualize, modify, construct and document the artifacts of an object-oriented software-intensive system. UML offers a standard way to visualize a system's blueprint. It can be used with all processes, throughout the software development life cycle, and across different implementation technologies. 2017. Gabriel Fung. 5

UML (3) Current version is UML 2.4 It has 14 types of diagrams divided into two categories Each category represents a different view of a model (discuss in the next two slides) 2017. Gabriel Fung. 6

Structure Diagrams Emphasize the things that must be presented in the system. Used extensively in documenting the software architecture Programmers will find them very useful in writing programs Diagrams Class diagram Object diagram Package diagram Component diagram Composite structure diagram Profile diagram Deployment diagram 2017. Gabriel Fung. 7

Behavior Diagrams Emphasize what must be happened in the system. Used extensively to describe the functionality of the system System managers and other non-programmers may find them useful in explaining the system Diagrams Activity diagram UML state machine diagram Use case diagram Communication diagram (a kind of interaction diagram) Interaction overview diagram (a kind of interaction diagram) Sequence diagram (a kind of interaction diagram) Timing diagram (a kind of interaction diagram) 2017. Gabriel Fung. 8

Class Diagram Overview Describes the structure of a system by showing the system's classes, attributes, and relationships among classes In a class diagram, there are many classes. Each class is represented by a box with three parts Top The name of the class Middle The properties/attributes of the class Bottom The methods of the class #, +, are known as visibility (See next slide) Person # name string age int + setname(name string) + getname() + setage(age int) + getage() 2017. Gabriel Fung. 9

Class Diagram Drawing Visibility used to specify the visibility of the attributes and methods (not mandatory, but usually has) + Public Private # Protected Relationship define the logical relationship among classes Major relationships Bi-directional, Uni-directional, Aggregation, Reflexive, Generalization, Realization 2017. Gabriel Fung. 10

Bi-Directional Relationship It is called Multiplicity Course name string code string + setname(namestring) + getname() 0..* 0..1 assigned assigned Room location String room int + setlocation(namestring) + getlocation() A classroom can be assigned to 0 to many courses Multiplicity A course can be assigned to 0 or 1 classroom Meaning x..y x to y (x 0, y > 0), e.g. 0..1, 0..2, 2..6, x..* x or more * Zero or more n n only, e.g. 1, 4, 10, 2017. Gabriel Fung. 11

Uni-Directional Relationship Printer printerid String + setjob(coursecode String) + getname() 0..* print Course coursecode String description String + setname(name String) + getname() In a uni-directional association, two classes are related, but only one class knows that the relationship exists. In this example, only the Printer class knows the existence of the Course class. This modeling allows printers know which courses they are printing, but the courses do not know they are being printed. This loosens the coupling of the objects and therefore makes the system more adaptive to changes. 2017. Gabriel Fung. 12

Uni-Directional Relationship (cont'd) GameRecord GameStage1 GameStage2 MyDB + connect() + disconnect() 2017. Gabriel Fung. 13

Aggregation / Composition Relationship (1) Building securityguard Person[] 1..* has Person Building has a non-trivial class "Person"! That s why we need to link it back! Note A non-fill diamond indicates the relationship is weak, i.e. even if Building is destroyed, Person (i.e. security guards) will not be destroyed. 2017. Gabriel Fung. 14

Aggregation / Composition Relationship (2) Building listofroom Room[] 1..* has Room Building has another non-trivial class! That s why we need to link it back! Note The diamond is filled, which means Room depends on Building, i.e. if the Building is destroyed, then all Rooms will also be destroyed. This type of strong aggregation is called Composition 2017. Gabriel Fung. 15

Aggregation / Composition Relationship (3) If necessary, we can have uni-directional relationship for aggregation/composition relationship A B A B 2017. Gabriel Fung. 16

Reflexive Relationship A room contains some rooms, e.g. RM101 contains RM101A and RM101B Building # name String # listofroom Room[] 1..* has Room # subroom Room 0..* contains Staff 0..* supervises 1 supervisor A kind of reflexive relationship. Again, it can be bi-directional or uni-directional A staff supervises 0 or many staff A staff has one supervisor 2017. Gabriel Fung. 17

Generalization Relationship Person # name String + getname() Generalization relationship Student studentid String + getgpa() Staff # salary int + getofficelocation() Professor housingallowance int Admin Staff 2017. Gabriel Fung. 18

Realization Relationship (1) It should contains nothing <<interface>> Person Realization relationship Can only be + or # + getname() Generalization relationship Student studentid String + getname() Staff # salary int + getname() Professor housingallowance int Admin Staff 2017. Gabriel Fung. 19

Realization Relationship (2) What is realization? Realization is one of the major properties of Object Oriented (OO) modeling, it implements an interface. Don t confuse with GUI (graphical user interface). This interface did nothing with GUI. In OO Programming, if a class is defined as an interface, it does not have any implementation detail. Hence, we need to write the details that are defined in the interface in the implementing classes. In the diagram in the previous slide, we need to write the getname method in the Student Class and Staff Class. It is the responsibility of the program designer to drop down every single implementation issue carefully and clearly in the diagram. 2017. Gabriel Fung. 20

Class Diagram Summary Class A Class A Class A Reflexive Class B Class B Bi-Directional Uni-Directional Class A Class A Class A Class A Class B Class B Class B Class B Aggregation Composition Realization Generalization 2017. Gabriel Fung. 21

Object Diagram An object diagram in the Unified Modeling Language (UML), is a diagram that shows a complete or partial view of the structure of a modeled system at a specific time. Remember the differences between Class and Object? Object diagrams are more concrete than class diagrams, and are often used to provide examples. An Object diagram focuses on some particular set of object instances and attributes, and the links between the instances. 2017. Gabriel Fung. 22

Object Diagram Example Building # name String # listofroom Room[] 1..* has Room # floor int ERB Building name = ERB listofroom = Vector<Room> has has ERM301 Room Floor 3 ERM401 Room Floor 4 has ERM506 Room Floor 5 2017. Gabriel Fung. 23

Object Diagram More Information Object diagrams help clarify classes and inheritance They are useful to demonstrate what would happen in the system at a specific time. Can help non-programmers to understand more about the system as they may find class diagrams are too abstract. May help programmers as well! Unfortunately, UML 2.4 specification provides no definition of object diagram! It does not have a concrete definition of how it should be drawn! 2017. Gabriel Fung. 24

Package Diagram Describes how a system is split up into logical groupings by showing the dependencies among these groupings. Package is a namespace used to group together elements that are semantically related and might change together. Because package is a namespace, elements (e.g. programs) inside the same package should have unique names. A package can import/access/use other packages. Package can also be merged with other packages. 2017. Gabriel Fung. 25

Package Diagram (cont d) For example, in a Java program package webshoppingcart; import basicwebcomponent; import java.io.*; import... public XXX extends GeneralShoppingCart{ } The name of the package that we created We need to import these packages A package is rendered as a tabbed folder We try to group programs into packages for better resources management. So we also need to tell the programmers how to implement our ideas! Web Shopping Cart 2017. Gabriel Fung. 26

Notations Import A relationship that shows the model elements in a package which are to be imported from another package and the visibility is public Access A relationship that shows the model elements in a package which are to be imported from another package and the visibility is private, i.e. other packages that merge/import it cannot access the packages it has accessed Note that it may be impossible to implement. Merge A relationship between two packages showing that their contents are to be combined. 2017. Gabriel Fung. 27

Package Diagram Example package Web Shopping Mobile Shopping Mail Shopping <<import>> <<import>> <<merge>> << import >> <<merge>> Inventory Payment << access>> Shopping Cart <<import>> Utility 2017. Gabriel Fung. 28

Component Diagram Describes how a software system is split up into components and shows the dependencies among these components. Developers find the component diagram useful because it provides them with a high-level, architectural view of the system Although may not be able to implement the system (too abstract), it helps developers formalizing a roadmap for the implementation, and make decisions about task assignments. System administrators find component diagrams useful because they get an early view of the logical software components that will be running on their systems. 2017. Gabriel Fung. 29

Components A Component Services/interface to be provided to other components A Component Services/interface required from other components A Component Services/interface to be provided to other components Services/interface required from other components 2017. Gabriel Fung. 30

Component Diagram Example OrderProduct Order Product Services Customer Detail Customer Product Code Product 2017. Gabriel Fung. 31

Composite Structure Diagram Visualizes the internal structure of a class. A kind of component diagram used in modeling a system at micro point-of-view. The key entities are Part A role played at runtime by an object or by a collection of objects Port An interaction point that can be used to connect other parts or the environment. Connector It binds entities together, allowing them to interact at runtime. Collaborator Represents by dotted oval. An abstract idea. 2017. Gabriel Fung. 32

Composite Structure Diagram Example environment Order Product Services part Search book Search CD Search Engine Search port Another Service A port Do Sth Request port Request Product port connector 2017. Gabriel Fung. 33

Deployment Diagram Describes the hardware used in system implementations and the execution environments and artifacts (e.g. software) deployed on the hardware. Note This is not UML standard components (for illustration purpose only) 2017. Gabriel Fung. 34

Deployment Diagram Example 2017. Gabriel Fung. 35

Use Case Diagram Describe a set of actions (use cases) that some systems should or can perform in collaboration with one or more external users (actors). Each use case should provide some observable and valuable result to the user of the system. Used to specify what the system should do but not how the system should do. Major elements of the use case diagram are Actor Association / Relationship Subject / System Use case 2017. Gabriel Fung. 36

Use Case Diagram Example Consider In a museum, visitors can purchase admission ticket through a clerk. Purchasing admission ticket requires a payment system, which will be connected to a bank. Note that purchasing admission ticket is a kind of help. In the museum, there is a manager who will mange the daily activities of the museum 2017. Gabriel Fung. 37

Use Case Diagram Example (cont'd) Actor Visitor Association / relationship Ask question Buy Admission Ticket Seek Help <<extend>> <<include>> Payment answer System Clerk Bank Manage Museum Museum Manager 2017. Gabriel Fung. 38

Use Case Diagram Example (cont'd) Another example In a museum, visitors can purchase admission ticket through a clerk. Purchasing admission ticket requires a payment system, which will be connected to a bank. Note that the visitors can seek help when purchasing admission ticket. In the museum, there is a manager who will mange the daily activities of the museum 2017. Gabriel Fung. 39

Use Case Diagram Example (cont'd) Note the keyword here also Seek Help answer Visitor Buy Admission Ticket <<include>> <<include>> Clerk $$$ Payment Bank Manage Museum Museum Manager 2017. Gabriel Fung. 40

Activity Diagram Graphical representations of workflows of stepwise activities and actions with support for choice, iteration and concurrency. Constructed from a limited number of shapes, connected with arrows. Common shapes Rounded rectangles represent activities; Diamonds represent decisions; Bars represent the start (split) or end (join) of concurrent activities; A black circle represents the start (initial state) of the workflow; An encircled black circle represents the end (final state). 2017. Gabriel Fung. 41

Activity Diagram Example Online shopping dislike Search item found View item Not found like Continue shopping Add to cart Done shopping Check out 2017. Gabriel Fung. 42

Activity Diagram Example (cont'd) Process Order Payment Problem Receive Order Payment OK Send invoice Ship order Close Order 2017. Gabriel Fung. 43

State Machine Diagram Describes the states and state transitions of the system Many software systems are event-driven They continuously wait for the occurrence of some external or internal event such as a mouse click, a button press... The response to an event generally depends on the type of the event and the state of the system E.g. if the user want to add an item to the shopping cart, but the shopping cart module is not available (i.e., the state of shopping cart module is down), then the user cannot perform the add item action. 2017. Gabriel Fung. 44

State Machine Diagram Example For example, in an ATM machine, there are three states, Idle, Active and Out of Service State Machine of ATM Shut down Damage Idle Put card Out of Services Fixed Take card Active 2017. Gabriel Fung. 45

Sequence Diagram Sequence diagram is the most common kind of interaction diagram, which focuses on the message interchange between a number of lifelines. A sequence diagram shows, as parallel vertical lines (lifelines), different processes or objects that live simultaneously, and, as horizontal arrows, the messages exchanged between them, in the order in which they occur. This allows the specification of simple runtime scenarios in a graphical manner. 2017. Gabriel Fung. 46

Sequence Diagram Example A simple online bank about transfer money sd online bank customer bank Transfer Money Response Logout Redirect to Homepage 2017. Gabriel Fung. 47

Sequence Diagram Example (cont'd) Note that a customer should be able to have multiple transfers! sd online bank customer bank loop Transfer Money Response Logout Redirect to Homepage 2017. Gabriel Fung. 48

Sequence Diagram Example (cont'd) We also want to add an option to our customers, such that they can input note before making a transfer! loop opt Input reference number Transfer Money Response 2017. Gabriel Fung. 49

Sequence Diagram Example (cont'd) How about if the customer do not have enough money? We should not make the transfer! loop opt Refer to the previous slide Transfer Money alt [enough money] Transfer OK [not enough money] Transfer fail 2017. Gabriel Fung. 50

Sequence Diagram of Facebook 2017. Gabriel Fung. 51

Communication Diagram Represents a combination of information taken from Class, Sequence, and Use Case Diagrams, describing both the static structure and dynamic behavior of a system. Communication diagrams show a lot of the same information as sequence diagrams, but are clearer to show the interaction among elements, whereas sequence diagrams are clearer to show the order in which the interactions take place. Uses free-form arrangement of objects and links. To maintain the ordering of messages, messages are labeled with a chronological number and placed near the link the message is sent. Reading a communication diagram involves starting at message 1.0, and following the messages from object to object. 2017. Gabriel Fung. 52

Communication Diagram Example coursedetail 2 getcoursename(courseid) string 3 getlocation() json 4 getstudentlist() array course 3.1 getbuildingname(locationid) string 3.2 getlocationname(locationid) string location staff 1.1 input courseid 1.2 click enquiry 1.3 enquiry(courseid) object student 4.1 getstudentname(studentid) string 4.2 getstudentmajor(studentid) string 2017. Gabriel Fung. 53

Timing Diagram Used to show interactions when the primary purpose of the diagram is to reason about time. Timing diagrams focus on conditions changing within and among lifelines along a linear time axis Server Processing Idle 100ms Browser Waiting Processing Idle 20ms 10ms Web User Viewing Waiting Idle 2017. Gabriel Fung. 54

Interaction Overview Diagram The interaction overview diagram is similar to combining activity diagrams, sequence diagrams and timing diagrams 2017. Gabriel Fung. 55

Interaction Overview Diagram Example 2017. Gabriel Fung. 56

References http//www.uml-diagrams.org/ http//www.uml.org/ https//creately.com/blog/diagrams/uml-diagramtypes-examples/ http//www.visual-paradigm.com/ 2017. Gabriel Fung. 57