UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.

Slides:



Advertisements
Similar presentations
UML and Classes, Objects and Relationships [1]
Advertisements

SE-1020 Dr. Mark L. Hornick 1 Inheritance and Polymorphism: Interfaces.
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.
Inheritance Inheritance Reserved word protected Reserved word super
Slides 4/22 COP Topics Final Exam Review Final Exam The final exam is Friday, April 29 th at 10:00 AM in the usual room No notes, books, calculators,
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
SE-1020 Dr. Mark L. Hornick 1 Inheritance and Polymorphism: Abstract Classes The “not quite” classes.
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.
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
Inheritance and Subclasses in Java CS 21a: Introduction to Computing I Department of Information Systems and Computer Science Ateneo de Manila University.
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
Object-Oriented Analysis and Design
COMS W4156: Advanced Software Engineering
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
State Machines State diagrams SE-2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
Introduction to Java Class Diagrams. Classes class Account { … } Account.
Detailed design – class design Domain Modeling SE-2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
Object-Oriented Programming in C++
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Chapter 16 Applying UML and Patterns Craig Larman
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Advanced UML Class Diagrams.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
SE-1020 Dr. Mark L. Hornick 1 Composition, Aggregation, and Inheritance - Introduction.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.
SE-1010 Dr. Mark L. Hornick 1 Java Programming Basics.
Inheritance and Access Control CS 162 (Summer 2009)
Chapter 8 Specialization aka Inheritance. 2 Inheritance  Review of class relationships  Uses – One class uses the services of another class, either.
Use Case Textual Analysis
Chapter 8 Inheritance. 2  Review of class relationships  Uses – One class uses the services of another class, either by making objects of that class.
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.
EE 422C Interfaces Day 5. 2 Announcements SVN has Project 2. –Partly due next week. –SVN update to get it in your repository. See Piazza for Grocery List.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
Class diagrams Terézia Mézešová.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
Model-View-Controller A Design Pattern SE-2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
CS 116 OBJECT ORIENTED PROGRAMMING II LECTURE 6 Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Unified Modeling Language (UML)
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
UML Review Sequence Diagrams SE-2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
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.
© 2010 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Appendix A: UML Java Software Structures: Designing and Using Data.
CS 350 – Software Design UML – The Unified Modeling Language – Chapter 2 The Unified Modeling Language is a visual language used to create models of programs.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Unified Modeling Language
A Review or Brief Introduction
Introduction to Unified Modeling Language (UML)
Class Diagram Details CS 124.
CSC 205 Java Programming II
The Basics of Class Diagrams for a single class
Defining Your Own Classes Part 1
Software Engineering Lecture #11.
CIS 375 Bruce R. Maxim UM-Dearborn
Introduction to UML Sources:
CIS 375 Bruce R. Maxim UM-Dearborn
The generalization of class
Presentation transcript:

UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.

Remember UML Diagrams from SE1021 or CS2852? Class diagram from SE1021 Lab 8: SE 2030 Dr. Rob Hasker 2 What does a Class diagram illustrate?

UML Review: Class diagrams A UML Class Diagram represents classes and their relationships to one another UML is not specific to Java, so a Class Diagram really represents the generic concept of a class without regard to what language implements the actual class The name of the class always appears at the top of a Class Diagram rectangle SE 2030 Dr. Rob Hasker 3 Account public class Account { }

Class diagrams: Attributes A Class Diagram can also show class attributes or fields Syntax: [visibility] [ : [=default_value] ] Note: The static specification may be illustrated with an underscore or with italics SE 2030 Dr. Rob Hasker 4 Account public class Account { private double balance; public static double rate = 2.5; } ????? What goes here?

Class diagrams: Attributes A Class Diagram can also show class attributes or fields Syntax: [visibility] [ : [=default_value] ] Note: The static specification may be illustrated with an underscore or with italics SE 2030 Dr. Rob Hasker 5 Account public class Account { private double balance; public static double rate = 2.5; } - balance: double + rate: double = 2.5

Class diagrams: Operations A Class Diagram can also show class methods or operations Syntax: [visibility] ([ [in|out] param:type]*] [: ] SE 2030 Dr. Rob Hasker 6 Account public class Account { private double balance; public static double rate = 2.5; public void deposit (double amount) { balance += amount; } protected double getBalance() { return balance; } public static void setRate(double intRate ) { rate = intRate; } - balance: double + rate: double = 2.5 ????? What goes here?

Class diagrams: Operations A Class Diagram can also show class methods or operations Syntax: [visibility] ([ [in|out] param:type]*] [: ] SE 2030 Dr. Rob Hasker 7 Account public class Account { private double balance; public static double rate = 2.5; public void deposit (double amount) { balance += amount; } protected double getBalance() { return balance; } public static void setRate( double intRate ) { rate = intRate; } - balance: double + rate: double= deposit(amount : double) : void # getBalance() : double + setRate(intRate: double) : void

Repeat: UML Class Diagrams typically illustrate some type of relationship between classes The easiest to master are those that illustrate a permanent (that is, static) relationship between classes There are two basic categories of static relationships: Inheritance Dependency SE 2030 Dr. Rob Hasker 8

Generalization is a form of Inheritance that indicates that a class (statically) inherits behavior defined and implemented in another class SE 2030 Dr. Rob Hasker 9 Here, the UML Generalization connector originates from the LoginScreen class inheriting the behavior (and attributes) of the JFrame class. The connector is a solid line pointing to the class whose behavior is being inherited with a triangle (not an arrow!) Generalization can be illustrated in the alternate notation shown if the parent class is not present in the class diagram

Realization is also a form of Inheritance that indicates that a class implements the behavior defined in an interface SE 2030 Dr. Rob Hasker 10 Here, the Realization connector originates from the LoginScreen class implementing the behavior of the Serializable class. The connector is a dashed line pointing to the class whose behavior is being implemented with a triangle (not an arrow!) Realization can also be illustrated in the alternate notation shown if the parent class is not present in the class diagram

Class diagrams sometimes explicitly illustrate Dependency relationships of classes on other classes (or packages) SE 2030 Dr. Rob Hasker 11 Dependency is indicated by a dashed-line connector, with the line originating from the dependent class and pointing (with an arrow) at the other class it depends upon. The arrow may also point at a package (e.g. javax.swing), implying a dependency on many of the classes within that package.

Review UML Class Diagrams Classes, attributes, operations/methods Associations Generalization, realization Dependencies SE 2030 Dr. Rob Hasker 12