UML Class Diagrams David Millard

Slides:



Advertisements
Similar presentations
CS 340 UML Class Diagrams. A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction.
Advertisements

UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Sucha Smanchat  Steps in OOAD using UML  Use Case Diagram  Sequence Diagram / Communication Diagram  Class Diagram  State.
Software Engineering COMP 201
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
Lecture 12: Chapter 22 Topics: UML (Contd.) –Relationship Structural Behavioral –Diagram Structural Behavioral.
The Unified Software Development Process - Workflows Ivar Jacobson, Grady Booch, James Rumbaugh Addison Wesley, 1999.
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Documenting Requirements using Use Case Diagrams
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
IELM 511: Information System design
© Copyright Eliyahu Brutman Programming Techniques Course.
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
Understand Application Lifecycle Management
Team Skill 6: Building the Right System From Use Cases to Implementation (25)
UML & Prototyping. What is a prototype? A prototype is a small-scale model. It can be (among other things): a series of screen sketches a storyboard,
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
CSC 395 – Software Engineering Lecture 13: Object-Oriented Analysis –or– Let the Pain Begin (At Least I’m Honest!)
Object-Oriented Modeling Chapter 10 CSCI CSCI 1302 – Object-Oriented Modeling2 Outline The Software Development Process Discovering Relationships.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
UML Class Diagrams and Caché CAMTA Meeting – 1 st December 2011 John Murray Senior Product Engineer.
Modeling Shari L. Pfleeger and Joanne M. Atlee, Software Engineering: Theory and Practice, 4 th edition, Prentice Hall, Hans Van Vliet, Software.
Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 15 System Modeling with the UML.
Unit 1 INTRODUCTION TO MODELING AND CLASS MODEL Ref : L7-UML.PDF.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
An Introduction to the Unified Modeling Language
Information Systems Engineering
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Design Jon Walker. More UML ● What is UML again?
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Unified Modelling Language (UML) Software Engineering Lab. Sharif University of Technology.
Domain Classes – Part 1.  Analyze Requirements as per Use Case Model  Domain Model (Conceptual Class Diagram)  Interaction (Sequence) Diagrams  System.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Chapter 3: Introducing the UML
CSCI 3428: Software Engineering Tami Meredith UML Unified Modeling Language.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Unified Modeling Language (UML)
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
Unified Modeling Language. What is UML? Standard language for specifying, visualizing, constructing, and documenting the artifacts of software systems,
Requirements capture: Using UML Use Cases David Millard and Yvonne Howard {dem,
UML Activity and Sequence Diagrams David Millard
Software Modelling Class Diagram. Class Diagrams The main building block in object oriented modeling They are used both for general conceptual modeling.
Comp 1100 Entity-Relationship (ER) Model
Modeling with UML – Class Diagrams
CHAPTER
UML Diagrams: Class Diagrams The Static Analysis Model
UML Diagrams By Daniel Damaris Novarianto S..
Object-Oriented Analysis and Design
Chapter 11 Object-Oriented Design
Unified Modeling Language
Reference: COS240 Syllabus
UML Diagrams Jung Woo.
SYS466 Domain Classes – Part 1.
Software Design Lecture : 15.
Copyright 2007 Oxford Consulting, Ltd
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Presentation transcript:

UML Class Diagrams David Millard

Overview The Ecology of UML ▫How to Use Cases, Activity, Sequence and Class diagrams fit into the big picture UML Class Diagrams ▫Data ▫Operations ▫Associations  Generalization  Aggregation vs. Composition

The Ecology of UML

UML Defines Two Types of Diagram Behaviour Activity Use Case State Transition

UML Defines Two Types of Diagram Behaviour Interaction Activity Use Case State Transition Communication Interaction Overview Timing Sequence ?

UML Defines Two Types of Diagram Behaviour Interaction Structure Activity Use Case State Transition Communication Interaction Overview Timing Sequence Profile Package Deployment Composite Component Object Class

Software Engineering: Big Picture Requirements Gathering Surveys User studies Focus groups SSM Specification UML Use Cases Scenarios Storyboards Design UML Class Diagrams Activity Diagrams Sequence Diagrams Etc… Implementation Software code APIs Document formats Testing Unit Tests Black Box Tests Etc… Deployment Configuration Bug Tracking User Support This is rarely a straightforward progression – in reality there are lots of iterations and points of feedback

Software Engineering: Big Picture Requirements Gathering Surveys User studies Focus groups SSM Specification UML Use Cases Scenarios Storyboards Design UML Class Diagrams Activity Diagrams Sequence Diagrams Etc… Implementation Software code APIs Document formats Testing Unit Tests Black Box Tests Etc… Deployment Configuration Bug Tracking User Support This is rarely a straightforward progression – in reality there are lots of iterations and points of feedback Designing a solution Specifying Data, Objects and Relationships

UML Class Diagrams

UML Class Diagrams: Classes We need to store several sorts of data about vehicles, including their fuel consumption and level of remaining fuel. Vehicles can move a given distance assuming that they have enough fuel. What is the name of the class? What are its properties? What are its operations?

UML Class Diagrams: Classes We need to store several sorts of data about vehicles, including their fuel consumption and level of remaining fuel. Vehicles can move a given distance assuming that they have enough fuel. Vehicle - fuel consumption : int - remaining fuel : int + move(int) : boolean name properties operations visibility (optional): we can show what is public using a + and what is private using a -

UML Class Diagrams: Associations Vehicles always have at least one driver. Each driver must have a single vehicle. Vehicle - fuel consumption : int - remaining fuel : int + move(int) : boolean

UML Class Diagrams: Associations Vehicles always have at least one driver. Each driver must have a single vehicle. Vehicle - fuel consumption : int - remaining fuel : int + move(int) : boolean Driver 1..* 1 Note that properties and operations are optional Associations are drawn as solid lines. Multiplicity is written at the target ends

UML Class Diagrams: Associations Vehicles always have at least one driver. Each driver must have a single vehicle. Vehicle - fuel consumption : int - remaining fuel : int + move(int) : boolean Driver 1..* 1 Note that properties and operations are optional Associations are drawn as solid lines. Multiplicity is written at the target ends - drivers Associations can optionally have a name and visibility

UML Class Diagrams: Generalization Drivers are a type of person. Every person has a name and an age. VehicleDriver 1..* 1 - drivers - fuel consumption : int - remaining fuel : int + move(int) : boolean

UML Class Diagrams: Generalization Drivers are a type of person. Every person has a name and an age. VehicleDriver 1..* 1 - drivers - name : String - age : int Person - fuel consumption : int - remaining fuel : int + move(int) : boolean Note: we use a special kind of arrowhead to represent generalization We assume that Driver inherits all the properties and operations of a Person (as well as defining its own)

UML Class Diagrams: Composition Vehicles are made up of many components. VehicleDriver 1..* 1 - name : String - age : int Person

UML Class Diagrams: Composition Vehicles are made up of many components. VehicleDriver 1..* 1 - name : String - age : int Person Component Note: we use a solid diamond to represent composition We can use the composition relationship when there is a strong lifecycle dependency (i.e. a thing is only a component when it is part of a vehicle)

UML Class Diagrams: Aggregation Vehicles are managed in a collection called a Fleet. VehicleDriver 1..* 1 - name : String - age : int Person Component

UML Class Diagrams: Aggregation Vehicles are managed in a collection called a Fleet. VehicleDriver 1..* 1 - name : String - age : int Person Component Fleet Note: we use an empty diamond to represent aggregation Use aggregation when there is a weak lifecycle dependency, i.e. vehicles can exist outside of a fleet

UML Class Diagrams Class Name - private property : type + public property : type - private operation(parameters) : return type multiplicity optional name Association Class Generalization (Inheritance) Composition (strong) Aggregation (weak) multiplicity

How might we model… Students and staff are both members of the University. Staff can be either academic, support or research staff.

How might we model… Students and staff are both members of the University. Staff can be either academic, support or research staff. Students Member Staff ResearchAcademicSupport

How might we model… A campus is made up of many buildings. A building is made of many rooms.

How might we model… A campus is made up of many buildings. A building is made of many rooms. Building Room Campus

How might we model… A Race has many competitors. Each competitor may have a trainer. Both types of person have a name, but competitors also have a number.

How might we model… A Race has many competitors. Each competitor may have a trainer. Both types of person have a name, but competitors also have a number. - name : String Person Trainer Competito r Race * - number : int

When to use Class Diagrams Whenever you want to model the types of things in a system, and how they relate to one another (sometimes called data modeling). Gives a data-centric view useful for: ▫Planning what classes are needed in OOP ▫Deciding on schema for databases But beware of getting bogged down in detail! ▫Common to ignore some aspects ▫E.g. Model classes and associations, but not properties or operations

Break…

Modeling Structure Here at ACME Aircraft Company we are proud of the specialist teams that create our futuristic aircraft. Each team employs both engineers and mathematicians. We know them all by name, and its also important that we know the specialism of our engineers. The engineers build the planes, but it’s the mathematicians that make all the calculations. The teams have a codename too. The aircraft are of course made of many thousands of complex components, and each has its own part number! Our planes are special to us, they each have a model number, but also an affectionate nickname. Our latest is called the Thunderbus! To get to the structure: What are the types of things in this scenario? What data do they hold? What behavior do they have? What are the relations between them? Get into pairs and try to create a class diagram…

Modeling Structure Here at ACME Aircraft Company we are proud of the specialist teams that create our futuristic aircraft. Each team employs both engineers and mathematicians. We know them all by name, and its also important that we know the specialism of our engineers. The engineers build the planes, but it’s the mathematicians that make all the calculations. The teams have a codename too. The aircraft are of course made of many thousands of complex components, and each has its own part number! Our planes are special to us, they each have a model number, but also an affectionate nickname. Our latest is called the Thunderbus! To get to the structure: What are the types of things in this scenario? What data do they hold? What behavior do they have? What are the relations between them? Get into pairs and try to create a class diagram…

Modeling Structure Here at ACME Aircraft Company we are proud of the specialist teams that create our futuristic aircraft. Each team employs both engineers and mathematicians. We know them all by name, and its also important that we know the specialism of our engineers. The engineers build the planes, but it’s the mathematicians that make all the calculations. The teams have a codename too. The aircraft are of course made of many thousands of complex components, and each has its own part number! Our planes are special to us, they each have a model number, but also an affectionate nickname. Our latest is called the Thunderbus! To get to the structure: What are the types of things in this scenario? What data do they hold? What behavior do they have? What are the relations between them? Get into pairs and try to create a class diagram…

Modeling Structure Here at ACME Aircraft Company we are proud of the specialist teams that create our futuristic aircraft. Each team employs both engineers and mathematicians. We know them all by name, and its also important that we know the specialism of our engineers. The engineers build the planes, but it’s the mathematicians that make all the calculations. The teams have a codename too. The aircraft are of course made of many thousands of complex components, and each has its own part number! Our planes are special to us, they each have a model number, but also an affectionate nickname. Our latest is called the Thunderbus! To get to the structure: What are the types of things in this scenario? What data do they hold? What behavior do they have? What are the relations between them? Get into pairs and try to create a class diagram…

Overview The Ecology of UML ▫How to Use Cases, Activity, Sequence and Class diagrams fit into the big picture UML Class Diagrams ▫Data ▫Operations ▫Associations  Generalization  Aggregation vs. Composition