UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, 2007. They may not be rehosted, sold, or modified without expressed permission.

Slides:



Advertisements
Similar presentations
Inheritance Inheritance Reserved word protected Reserved word super
Advertisements

UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION UNIFIED MODELING LANGUAGE (UML) Autumn 2011
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 8.1 – 8.5.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
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.
IMSE 11 - UML Class Diagrams
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence.
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
CSE 403 Lecture 7 UML Class Diagrams Reading:
1 CSE 403 Design and UML Class Diagrams Reading: UML Distilled Ch. 3, by M. Fowler These lecture slides are copyright (C) Marty Stepp, They may not.
1 TCSS 360, Spring 2005 Lecture Notes Design Phase and UML Class Diagrams Relevant Reading: UML Distilled, Third Edition M. Fowler.
UML January 24, 2011 CSE 403, Winter 2011, Brun Design and UML Class Diagrams.
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
Object-Oriented Analysis and Design
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
UML Overview. UML Diagrams to be Covered Class Diagrams Use Case Diagrams Collaboration Diagrams Sequence Diagrams Package Diagrams Component Diagrams.
ITEC 370 Lecture 10 Design. Review Design –Why is it part of the process? –Who is the audience for design?
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
Class Relationships and Object Interaction. 8/8/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 13 (Online): Object-Oriented Data Modeling Modern Database Management 10 th Edition.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
1 Class Diagrams: Advanced Concepts. 2 Overview Class diagrams are the most commonly used diagrams in UML. Class diagrams are the most commonly used diagrams.
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML Class Diagrams.
An Introduction to the Unified Modeling Language
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.
Chapter 5 System Modeling Sommerville, "software engineering ", 9 th Ed., 2011.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
UML Class Diagram. A class diagram shows 1.Classes 2.The relationships between them.
Encapsulation ◦ Blackbox concept Data and method(s) Hidden details InterfaceEffect(s) methods called class.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Class diagrams Terézia Mézešová.
Introduction to UML Todd Bacastow Rational Unified Process A process for the effective implementation of key “Best Practices” Control Changes Manage.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Unified Modeling Language (UML)
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Inf 43: Introduction to Software Engineering May 7, 2016.
Software Modelling Class Diagram. Class Diagrams The main building block in object oriented modeling They are used both for general conceptual modeling.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Design and UML Class Diagrams
Chapter 12 – Object-Oriented Design
TCSS 305 (Stepp) OO Design with UML Class Diagrams
Object-Orientated Analysis, Design and Programming
UML Diagrams: Class Diagrams The Static Analysis Model
Unified Modeling Language
Unified Modeling Language—UML A Very Brief Introduction
Lecture on Design Phase and UML Class Diagrams
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Object Oriented Analysis and Design
Seminar 3 UML Class Diagram.
Software Engineering Lecture #11.
Unified Modelling Language
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Introduction to UML Sources:
Object Oriented System Design Class Diagrams
The generalization of class
Presentation transcript:

UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission from the author. All rights reserved.

UML class diagrams What is a UML class diagram? What are some things that are not represented in a UML class diagram? 2 details of how the classes interact with each other algorithmic details; how a particular behavior is implemented UML class diagram: a picture of the classes in an OO system, their fields and methods, and connections between the classes that interact or inherit from each other

Diagram of one class class name in top of box write > on top of interfaces' names use italics for an abstract class name attributes (optional) should include all fields of the object operations / methods (optional) may omit trivial (get/set) methods but don't omit any methods from an interface! should not include inherited methods 3

Class attributes attributes (fields, instance variables) visibility name : type [count] = default_value visibility:+public #protected -private ~package (default) /derived underline static attributes derived attribute: not stored, but can be computed from other attribute values attribute example: - balance : double =

Class operations / methods operations / methods visibility name (parameters) : return_type visibility:+public #protected -private ~package (default) underline static methods parameter types listed as (name: type) omit return_type on constructors and when return type is void method example: + distance(p1: Point, p2: Point): double 5

Comments represented as a folded note, attached to the appropriate class/method/etc by a dashed line 6

Relationships btwn. classes generalization: an inheritance relationship inheritance between classes interface implementation association: a usage relationship dependency aggregation composition 7

Generalization relationships generalization (inheritance) relationships hierarchies drawn top-down with arrows pointing upward to parent line/arrow styles differ, based on whether parent is a(n): class: solid line, black arrow abstract class: solid line, white arrow interface: dashed line, white arrow we often don't draw trivial / obvious generalization relationships, such as drawing the Object class as a parent 8

Associational relationships associational (usage) relationships 1. multiplicity (how many are used) * 0, 1, or more 1 1 exactly 2..4 between 2 and 4, inclusive 3..* 3 or more 2. name (what relationship the objects have) 3. navigability (direction) 9

Association types aggregation: "is part of" symbolized by a clear white diamond composition: "is entirely made of" stronger version of aggregation the parts live and die with the whole symbolized by a black diamond dependency: "uses temporarily" symbolized by dotted line often is an implementation detail, not an intrinsic part of that object's state 10 * 1 Classroom aggregation Student Lottery Ticket Random dependency Page Book composition * 1

Class diagram example 11 DVD MovieVHS MovieVideo Game Rental Item Rental Invoice 1..* 1 Customer Checkout Screen Simple Association Class Abstract Class Simple Aggregation Generalization Composition Multiplicity