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

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

Unified Modeling Language (UML) Class Diagram

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

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

CS 451 Software Engineering

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

UML. By Somenath Mukhopadhyay.

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

Practical UML - A Hands-On Introduction for Developers

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

Object-Oriented and Classical Software Engineering

Progress Report. Object-Oriented Software Development: Requirements elicitation and analysis. Object-oriented analysis, design, implementation

Unified Modeling Language (UML)

12 Tutorial on UML. TIMe TIMe Electronic Textbook

UML Sequence Diagrams for Process Views

Practical UML : A Hands-On Introduction for Developers

CS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams in UML

Chapter 2: The Object-Oriented Design Process

Chapter 5: Structural Modeling

Basic Structural Modeling. Copyright Joey Paquet,

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

OO Techniques & UML Class Diagrams

Progress Report. Object-Oriented Software Development: Requirements elicitation (ch. 4) and analysis (ch. 5) Object-oriented software development

Software Service Engineering

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

Entity Relationship Modelling

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

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

Requirements Engineering

Lecture 21 Detailed Design Dynamic Modeling with UML

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

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

CSCI 253. Outline. Rationale. George Blankenship 1. Object Oriented Design: UML. George Blankenship

CS211 Lecture: Modeling Dynamic Behaviors of Systems; Interaction Diagrams and Statecharts Diagrams in UML

Course "Softwaretechnik" Book Chapter 2 Modeling with UML

(C) 2010 Pearson Education, Inc. All rights reserved. Dr. Marenglen Biba

Lecture 09. Spring 2018 Borough of Manhattan Community College

Chapter 2, lecture 2 Modeling with UML

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

SOFTWARE DESIGN COSC 4353 / Dr. Raj Singh

Fundamentals of Health Workflow Process Analysis and Redesign

Software Engineering Fall 2014

Interactions A link message

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

Intro to DB CHAPTER 6

7. UML Sequence Diagrams Page 1 of 1

Data Analysis 1. Chapter 2.1 V3.1. Napier University Dr Gordon Russell

Unified Modeling Language

UML Class Diagrams Revisited

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Interaction Modelling: Sequence Diagrams

Object Oriented Modeling

UML Tutorial. Unified Modeling Language UML Tutorial

Class modelling (part 2)

IS 0020 Program Design and Software Tools

More on the Chen Notation

Relationships. Association Aggregation/Composition Multiplicity Dependencies

A l Ain University Of Science and Technology

Introduction to UML and Class Diagrams

Sequence Diagrams. Massimo Felici. Massimo Felici Sequence Diagrams c

LABORATORY 1 REVISION

Class modelling (part 2)

A l Ain University Of Science and Technology

MSc programme (induction week) Department of Informatics INTRODUCTION TO UML

UNIT-4 Behavioral Diagrams

Object-Oriented Systems Analysis and Design Using UML

CMPT 354 Database Systems I

Introducing the UML Eng. Mohammed T. Abo Alroos

Using High-Level Conceptual Data Models for Database Design A Sample Database Application Entity Types, Entity Sets, Attributes, and Keys

Entity-Relationship Model. From Chapter 5, Kroenke book

Object Oriented Methods with UML. Lecture -4

UML: Unified Modeling Language

Slide 1 Welcome to Fundamentals of Health Workflow Process Analysis and Redesign: Process Mapping: Gane-Sarson Notation. This is Lecture d.

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

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

CSE 308. UML Sequence Diagrams. Reading / Reference.

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Introduction to Unified Modelling Language (UML)

SQL DDL. CS3 Database Systems Weeks 4-5 SQL DDL Database design. Key Constraints. Inclusion Constraints

OO System Models Static Views

Chapter 2, Modeling with UML, Part 2

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 09/29/2015

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

Object-Interaction Diagrams: Sequence Diagrams UML


Meltem Özturan

SE 1: Software Requirements Specification and Analysis

Chapter 6: Entity-Relationship Model

DATA MODELS FOR SEMISTRUCTURED DATA

Ch 4: Requirements Engineering. What are requirements?

administrivia today UML start design patterns Tuesday, September 28, 2010

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

A Rapid Overview of UML

Lecture 17: (Architecture V)

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

DEMO-3.6c models and representations slide 2

Use Case Sequence Diagram. Slide 1

Chapter 2: Entity-Relationship Model

Transcription:

Class diagrams Modeling with UML Chapter 2, part 2 CS 4354 Summer II 2014 Jill Seaman Used to describe the internal structure of the system. Also used to describe the application domain. They describe the system in terms of Classes, an abstract representation of a set of objects Attributes, properties of the objects in a class Operations that can be performed on objects in a class Associations that can occur between objects in various classes 1 2 Class diagram for a simple watch Class Diagrams: details Can represent classes OR objects Classes (and objects) are boxes composed of three compartments: Top compartment: name Center compartment: attributes (may be omitted for simplicity/delay) Boxes are classes Lines show associations (between objects) Numbers show how many objects must be associated Bottom compartment: operations (may be omitted for simplicity/delay) Conventions: Object names (when used) are underlined to indicate they are instances Class names start with uppercase letter Named objects start with lowercase 3 4

UML class diagram: classes that participate in the ReportEmergency use case. UML object diagram: objects that participate in the warehouseonfire scenario. Note object names are underlined, multiple instances of FieldOfficer. 5 These kinds of diagrams are not commonly used. 6 Associations and links Example of a unidirectional association A link represents a connection between two objects. Associations are relationships between classes and represent the fact that links may (or do) exist between object instances. Links and associations are noted with a line between the boxes. Associations can be symmetrical (bidirectional) or asymmetrical (unidirectional). Unidirectional association is indicated by using a line with an arrow The arrow indicated in which direction navigation is supported. If the line has no arrows, it s assumed to be bidirectional. This system supports navigation from the Polygon to the Point, but not vice versa. Given a specific Polygon, it is possible to query all Points that make up the Polygon. But a given Point does not know which Polygon(s) it belongs to. *Note: the diagram in the book is wrong 7 8

Association class Roles Association class: an association with attributes and/or operations Depicted by a class symbol that contains the attributes and operations and is connected to the association symbol with a dashed line. Each end of an association can be labeled by a role. Allows us to distinguish among the multiple associations originating from a class. An employee can belong to a department and be the head of the department. Roles clarify the purpose of the association. Previous slide: The FieldOfficers allocated to a given incident are called resources. These kinds of classes are not commonly used. 9 10 Multiplicity Examples of multiplicity Multiplicity: a set of integers labeling one end of an association Indicates how many links can originate from an instance of the class at the other end of the association. * is shorthand for 0..n, called many Most associations belong to one of these three types: A one-to-one association has a multiplicity 1 on each end. A one-to-many association has a multiplicity 1 on one end and 0..n (*) or 1..n on the other. A many-to-many association has a multiplicity 0..n or 1..n on both ends. CourseSection * 1 Student A CourseSection contains many Students A Student is enrolled in many CourseSections How many reports can a FieldOfficer write? How many authors of a report can there be? 11 12

Aggregation and Composition Examples of a aggregations Aggregation is a kind of association that specifies a whole/part relationship between the aggregate (whole) and component part. Useful to denote hierarchical relationships (directory contains files) Specified with an open diamond on the aggregate (whole) side. Composition is a special case of aggregation where the composite object has sole responsibility for the life cycle of the component parts. The composite is responsible for the creation and destruction of the component parts. An object may be part of only one composite. Specified with a closed diamond on the composite (whole) side. Could any of these be composites? can a County belong to more than one State? can a County exist without a State? 13 14 Inheritance Inheritance example Inheritance is a relationship between a base class and a more refined class. the refined class has attributes and operations of its own, as well as the attributes and operations of the base class (it inherits them). Abstract class: name in italics Doctor Name Phone # Email register ( ) de-register ( ) Note the operations Overridden operations are not shown Hospital doctor Staff # Pager # General practitioner Practice Address 15 16

Example of a hierarchical file system Class diagram with an interface 17 18 When and how to use Class Diagrams Sequence Diagrams All the time. Try to keep them simple, don t use unnecessary notation. Especially if you are using them to model the application domain. If you want to specify the implementation very specifically, you will use more of the notation. Don t draw models for every part of the program (at least not all in great detail) Focus first on concepts, then add detail as the design process continues. Represent the dynamic behavior of the system Describe patterns of communication among a set of interacting objects. An object interacts with another object by sending messages. The message must be an operation of the receiving object. Arguments may be passed along with a message they correspond to the parameters of the receiver s operation. A Sequence diagram should be consistent with any existing class diagrams (this is where the messages (operations) are specified). 19 20

Sequence diagram for a simple watch Sequence Diagrams Actor and objects (not classes) across the top Vertical lines are time lines of the objects Labeled arrows are messages sent to another object 21 Objects across the top (horizontal axis) Time goes down (vertical axis) Diagram components: Solid horizontal arrows: messages Labels on arrows: message names (arguments optional) Return arrows (at end of operation, going back) are optional Vertical rectangle: an activation (lifetime) of an operation Interactions involving actors may not be operations. 22 Sequence diagram: setting the time on 2Bwatch. Sequence Diagrams: iteration and branching Notation for iteration (loops) Repeated message has an asterisk (see next slide: *op3()) Optional: indicate basis of iteration in brackets: *[for all order lines] op3() Notation for conditions (alternatives) Conditional message is marked with a guard (see next slide) OR Alternative message(s) in a partitioned box labeled alt each partition has a guarded message (see next next slide) May be easier to draw a separate diagram for each alternative If you really want to model control flow, you should use an activity diagram instead. 23 24

Conditions and iterators in sequence diagrams. Using alt box to show branching. Medical Receptionist A window from the user interface Arrows with common start point are mutually exclusive alternatives ViewInfo (PID) P: PatientInfo report (Info, PID, UID) D: MHCPMS-DB AS: Authorization authorize (Info, UID) authorization PID: patient ID UID: user ID Info: kind of info to be returned alt [authorization OK] Patient info [authorization fail] Error (no access) 25 26 Sequence Diagrams: additional notations Self-call (operation calls itself) Message arrow back to original activation: Creating new instances: new Class() message points to object s box: new Mailbox() 27 28

When and how to use Sequence Diagrams When you want to look at the behavior of several objects within a single use case. When the order of the method calls in the code seems confusing. When you are trying to determine which class should contain a given method. to uncover the responsibilities of the classes in the class diagrams to discover even new classes During Object-Oriented Design, sequence diagrams and the class diagram are often developed in tandem. 29