UML Examples Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.

Slides:



Advertisements
Similar presentations
UML Class Diagrams. Represent the (static) structure of the system GeneralIn JavaIn C++ NameNameName StateVariablesMembers BehaviorMethodsFunctions.
Advertisements

1 Object-oriented design Part 2: OO tools & UML. 2 CRC cards Design tool & method for discovering classes, responsibilities, & relationships Record on.
Data Structures & Java Generics Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-oriented modeling Class/Object Diagrams
Inheritance Inheritance Reserved word protected Reserved word super
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Object-Oriented Design & Programming Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 8.1 – 8.5.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 1 UML First Pass: Class Diagrams Battery load()
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Software Development Study Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
UML: Unified Modeling Language L. Grewe History Graphic modeling language for describing object-oriented software Graphic modeling language for describing.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
CMSC 132: Object-Oriented Programming II
Midterm 1 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Final Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Scott Grissom, copyright 2004Ch 2 OO Design Slide 1 Object Oriented Design Chapter 2 focuses on: objects, classes inheritance polymorphism UML class diagrams.
Object-Oriented Design 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
Inheritance. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 Inheritance Inheritance is a fundamental object-oriented design technique used to.
Unified Modeling Language
Unified Modeling Language
 2008 Pearson Education, Inc. All rights reserved (Optional) Software Engineering Case Study: Identifying the Classes in the ATM Requirements.
Software Construction Lecture 5 Class Diagrams. Agenda 2  Topics:  Examples of class diagrams  Navigation, visibility, named associations, and multiplicity.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
Big Java Chapter 12. Software Process - Waterfall Analysis Design Implementation Testing Deployment Does not work well when rigidly applied! established.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
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.
Lab 04.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Domain Modeling Part2: Domain Class Diagram Chapter 4 pp part 2 1.
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.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
PROG Object Oriented Programming II With Java PROG Object Oriented Programming II With Java Class Relationships.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
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.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Outline Creating Subclasses Overriding Methods Class Hierarchies Visibility Designing for Inheritance Inheritance and GUIs The Timer Class Copyright ©
Inheritance. Inheritance is a fundamental object-oriented design technique used to create and organize reusable classes Chapter 8 focuses on: deriving.
Chapter 8 Specialization aka Inheritance. 2 Inheritance  Review of class relationships  Uses – One class uses the services of another class, either.
Using UML, Patterns, and Java Object-Oriented Software Engineering More on UML Note: Slides are adapted by Linda Sherrell from the Software Engineering.
Chapter 8 Inheritance. 2  Review of class relationships  Uses – One class uses the services of another class, either by making objects of that class.
CSE 219 Computer Science III UML. UML Diagrams UML - Unified Modeling Language UML diagrams are used to design object-oriented software systems –represent.
Encapsulation ◦ Blackbox concept Data and method(s) Hidden details InterfaceEffect(s) methods called class.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 – 9.4.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Outline Creating Subclasses Overriding Methods Class Hierarchies Inheritance.
Class Diagram UML Annotations Example: cs.gordon.edu/courses/cps211/ATMExamp le/ClassDiagram.html cs.gordon.edu/courses/cps211/ATMExamp.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
Class Diagram Associations Class Diagrams, Class Stereotypes, Class Associations Dr. Neal CIS 480.
Chapter 12 – Object-Oriented Design
UML Diagrams: Class Diagrams The Static Analysis Model
Object Oriented Analysis and Design Using the UML
Chapter 12 – Object-Oriented Design
Object Oriented System Design Class Diagrams
Warmup Which of the 4 sorting algorithms uses recursion?
Presentation transcript:

UML Examples Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park

UML Class Diagrams Represent the (static) structure of the system GeneralIn JavaName StateVariables BehaviorMethods

Relationships Between Classes Association Permanent, structural, “has a” Solid line (arrowhead optional) Dependency Temporary, “uses a” Dotted line with arrowhead Generalization Inheritance, “is a” Solid line with open (triangular) arrowhead Implementation Dotted line with open (triangular) arrowhead OR

Association Denotes permanent, structural relationship State of class A contains class B Represented by solid line (arrowhead optional) Car and Engine classes know about each other

Associations w/ Navigation Information Can indicate direction of relationship Represented by solid line with arrowhead Gas Pedal class knows about Engine class Engine class doesn’t know about Gas Pedal class

Associations w/ Navigation Information Denotes “has-a” relationship between classes “Gas Pedal” has a “Engine” State of Gas Pedal class contains instance of Engine class  can invoke its methods

Multiplicity of Associations Some relationships may be quantified Multiplicity denotes how many objects the source object can legitimately reference Notation *  0, 1, or more 5  5 exactly 5..8  between 5 and 8, inclusive 5..*  5 or more

Multiplicity of Associations Many-to-one Bank has many ATMs, ATM knows only 1 bank One-to-many Inventory has many items, items know 1 inventory

Association – Aggregation Special case of association denotes a “consists of” hierarchy Aggregate is the parent class Components are the children class Represented by line ending in open diamond 1 Exhaust SystemMufflerTailpipe 0..2

Dependency Denotes dependence between classes Always directed (Class A depends on B) Represented by dotted line with arrowhead A depends on B AB

Dependency Caused by class methods Method in Class A temporarily “uses a” object of type Class B Change in Class B may affect class A A uses object of class B AB

Dependency Dependence may be caused by Local variable Parameter Return value Example Class A {Class B { B Foo(B x) {… B y = new();… return y;… }} }

Dependency Example Class Driver depends on Class Car

Generalization Denotes inheritance between classes Can view as “is-a” relationship Represented by line ending in (open) triangle Laptop, Desktop, PDA inherit state & behavior from Computers

Implementation Denotes class implements Java interface Represented by dotted line ending in (open) triangle A implements interface B A«B»«B»

UML Examples Read UML class diagram Try to understand relationships Examples Pets & owners Computer disk organization Library books Banking system Home heating system Printing system

UML Example – Veterinary System Try to read & understand UML diagram

UML Example – Veterinary System Try to read & understand UML diagram 1 or more Pets associated with 1 PetOwner

UML Example – Computer System Try to read & understand UML diagram

UML Example – Computer System Try to read & understand UML diagram 1 CPU associated with 0 or more Controllers 1-4 DiskDrives associated with 1 SCSIController SCSIController is a (specialized) Controller

UML Example – Library System Try to read & understand UML diagram

UML Example – Library System Try to read & understand UML diagram 1 or more Book associated with 1 or more Pages Patron & Shelf temporarily use (depend on) Books

UML Example – Banking System Try to read & understand UML diagram

UML Example – Banking System 1 Bank associated with 0 or more Accounts Checking, Savings, MoneyMarket are Accounts

UML Example – Home Heating System Try to read & understand UML diagram

UML Example – Home Heating System Room has 1 Thermostat Each Thermostat associated with 0 or more Heaters ElectricHeater is a specialized Heater AubeTH101D is a specialized Thermostat

UML Example – Printing System