IMSE 11 - UML Class Diagrams

Slides:



Advertisements
Similar presentations
UML an overview.
Advertisements

214 CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS.
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
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.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS
Improved software quality through semantic descriptions (Skutt) Karlstad University Dept. of Computer Science UML introduction A short introduction.
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Slide 1 Chapter 7 Structural Modeling. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Chapter 14 (Web): Object-Oriented Data Modeling
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.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Class Diagram & Object Diagram
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 Class and Object Diagrams PRACTICAL OBJECT-ORIENTED DESIGN WITH.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
Chapter 4: Object-Oriented Data Modeling
7M822 UML Class Diagrams advanced concepts 14 October 2010.
Chapter 14: Object-Oriented Data Modeling
Unified Modeling Language
Object-Oriented Analysis and Design
ZEIT2301 Design of Information Systems Structural Design: Class Diagrams School of Engineering and Information Technology Dr Kathryn Merrick.
CONCEPTUAL DESIGN: UML CLASS DIAGRAM RELATIONSHIPS
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
1 UML Basic Training. UML Basic training2 Agenda  Definitions: requirements, design  Basics of Unified Modeling Language 1.4  SysML.
Slide 1 Structural Modeling Chapter 7. Slide 2 Key Ideas A structural or conceptual model describes the structure of the data that supports the business.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Distributed Java Programming Distributed Java Programming Class #2 August 22, 2002.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
CHAPTER 13 (ONLINE): OBJECT-ORIENTED DATA MODELING © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
1 © Prentice Hall, 2002 Chapter 14: Object-Oriented Data Modeling Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R.
A little bit of UML Csaba Veres. UML A de facto standard for OO analysis and design Many components class diagrams use cases interaction diagrams...
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
Fall 2010 CS4310 Requirements Engineering A Brief Review of UML & OO Dr. Guoqiang Hu Department of Computer Science UTEP 1.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
SWT - Diagrammatics Lecture 4/4 - Diagramming in OO Software Development - partB 4-May-2000.
Object-Oriented Data Modeling
Design Model Lecture p6 T120B pavasario sem.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Object Oriented Analysis and Design Class and Object Diagrams.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Database Design – Lecture 12 Object Oriented Database Design cont’d.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
Class diagrams Terézia Mézešová.
CSCI 3428: Software Engineering Tami Meredith UML Unified Modeling Language.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
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.
Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Modeling with UML – Class Diagrams
Unified Modeling Language (UML)
UML Class Diagrams (more notation)
Object-Oriented Analysis and Design
Object-Oriented Modeling with UML
EKT472: Object Oriented Programming
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
A short introduction to UML Eivind J. Nordby Karlstad University
Domain Class Diagram Chapter 4 Part 2 pp
Software Engineering Lecture #11.
Business Analysis More on Classes Chris Russell O2.41
Object Oriented System Design Class Diagrams
Information System Design
ITEC324 Principle of CS III
Presentation transcript:

IMSE 11 - UML Class Diagrams a modeling language is the graphical notation used in developing a system UML is known as the Unified Modeling Language because it unifies the earlier graphical notations of: Booch Jacobson and Rambaugh (the 3 amigos) who collaborated to produce UML other important O-O precursors: Coad and Yourdon (OOA, OOD) Wilfs-Brock (responsibility-driven design) Cunningham and Beck (class-responsibility-collaboration cards) UML is very young (1998) and is now the industry-wide standard modeling language for O-O systems

Familiar and Unfamiliar Concepts in UML UML caters for many of the general OO concepts we are already familiar with, e.g. classes with attributes and operations or methods relationships between classes (inheritance (known as generalisation in UML) aggregation, association) cardinality of relationships, known as multiplicity in UML abstract classes some concepts we haven’t met in earlier lectures are provided by UML, e.g. multiple classification, dynamic classification, composition, derived attributes, qualified association, parameterised classes

UML Diagrams UML uses diagrams and symbols of many types, e.g. class diagrams interaction diagrams: sequence diagrams collaboration diagrams use case diagrams package diagrams state diagrams activity diagrams deployment diagrams many of the diagrams are developed in and belong to the analysis stage of software development for the high level design of a system we will focus on class diagrams

Class Diagrams describe the types of objects in the system show the attributes and operations show the static relationships between the objects main types of relationships: - generalisation - “type of” - association e.g. project leader and company car - aggregation and composition - “part of” also show multiplicity, navigability, derived attributes, visibility (public, private, protected), multiple classification, discriminators, dynamic classification etc, etc ...

Generalisation ... ... UML’s term for inheritance is generalisation Student reg no. name address change address a clear triangular arrowhead symbolises generalisation superclass subclass BABC Student BUS279 gp ... HND Student COH208 gp ... HND students are a type of student

Association and Roles an association has 2 roles, e.g: - the role from project leader to company car - the role from company car to project leader a role may be labeled with a name: - a project leader “has the use of” a company car - a company car “is allocated to” a project leader the name of the role can be the same as the target class Project Leader name ... Company Car reg. no. … ... has the use of is allocated to

Multiplicity multiplicity is UML’s term for cardinality multiplicity is shown on class diagrams it states how many objects can participate in a relationship 1 precisely one n n is any number * the range zero to infinity 1 .. * the range one to infinity 0 .. 1 zero or one n1 .. n2 the range n1 to n2 (one number to another) e.gs. car and engine book and pages 1 *

Aggregation the “part of” relationship e.g. car and engine symbolised by a clear diamond some analysts would also include a company and its employees the multiplicity is shown, a car and engine have a 1 to 1 relationship of association engine car 1 aggregation

Composition stronger version of aggregation the parts live and die with the whole symbolised by a filled-in diamond 2 ways of representing composition: pages book book pages * composition 1 * multiplicity = * i.e. any no. from 0 upwards

Navigability does the project leader class have an attribute for storing a company car registration number? or does the company car class have an attribute for holding a project leader’s name? or both? to describe this we say that the association between project leader and company car has a navigability navigabilities are shown by an arrow, which may be uni-directional or bi-directional

Navigabilities the direction of the association arrow reveals the class that knows (or is responsible for) which object it will be associated with Project Leader name car reg. no.. ... Project Leader name ... Project Leader name car reg. no. ... Company Car reg. no. .. Company Car reg. no. proj ldr’s name ... Company Car reg. no. proj ldr’s name ..

Derived Attributes date of birth is an attribute of person age is a derived attribute as it is not stored, but can be derived from date of birth derived attributes are symbolised by a forward slash Person date of birth / age derived attribute

Visibility the attributes and operations of a class may have public, private or protected visibility public - can be used by any other class private - can be used only by objects of this class protected - can be used by this class and its subclasses UML notation for each: + public e.g. + name - private e.g. - salary # protected e.g. # display supervisor subtle differences exist at implementation stage, depending on the programming language used

Multiple Classification classification - the relationship between an object and its type single classification - an object belongs to a single type which may inherit from supertypes multiple classification - an object may be described by several types not necessarily connected by inheritance e.g. a person may also be described as - a man or a woman - and a patient - and a doctor or a nurse note that multiple classification is completely different to multiple inheritance, e.g. a hovercraft each hovercraft is an instance of the single type hovercraft, even though it has more than one supertype

Example of Multiple Classification Female Male Doctor Nurse Person Patient

Discriminators male and female are subtypes of person each person cannot be both male and female each person cannot be both a doctor and a nurse we show this on a class diagram by joining the generalisation lines into one triangular arrowhead, and labelling the line with a discriminator so several subtypes share a discriminator and if a discriminator is labeled {complete} then an instance of the supertype (e.g. person) must be an instance of one of the subtypes (e.g. female) note that sex is a complete discriminator but job is not - as every person is either male or female, but not every person is a doctor or nurse

Example of Multiple Classification discriminator sex {complete} Female Male Person Patient Doctor Nurse job <<dynamic>> Legal combinations: female, patient, doctor male, nurse male, patient Illegal combinations: patient, doctor (must include male or female as sex is a complete discriminator) female, doctor, nurse (contains 2 types from the discriminator job)

Dynamic Classification on the class diagram showing the example of multiple classification the discriminator “job” is marked as <<dynamic>> this shows that a person’s job in the system will be able to change (nurses may become doctors and vice versa) so objects are allowed to change type within the subtype structure dynamic classification allows this, static classification does not useful for bank accounts - when a bank account is overdrawn it changes behaviour - operations such as withdraw and close are overridden