UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.

Slides:



Advertisements
Similar presentations
SE-1020 Dr. Mark L. Hornick 1 Inheritance and Polymorphism: Interfaces.
Advertisements

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
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.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
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 ○
Introduction to Java Class Diagrams. Classes class Account { … } Account.
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
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.
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.
Object Oriented Analysis and Design Class and Object Diagrams.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
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.
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.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
Class diagrams Terézia Mézešová.
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:
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.
© 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.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Introduction to Object-oriented Programming
Unified Modeling Language (UML)
Unified Modeling Language Tutorial
Unified Modeling Language
A Review or Brief Introduction
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Introduction to Unified Modeling Language (UML)
Class Diagram Details CS 124.
Creating and Using Classes
A tool for presentation of Architecture
A tool for presentation of Architecture
CSC 205 Java Programming II
UML Diagrams: The Static Model Class Diagrams
The Basics of Class Diagrams for a single class
Defining Your Own Classes Part 1
Corresponds with Chapter 7
Software Engineering Lecture #11.
Advanced State Chart diagrams
CIS 375 Bruce R. Maxim UM-Dearborn
Java Programming, Second Edition
Introduction to UML Sources:
CIS 375 Bruce R. Maxim UM-Dearborn
Object Oriented System Design Class Diagrams
The generalization of class
Presentation transcript:

UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1

Remember UML Diagrams from SE1021 or CS2852? Class diagram from SE1021 Lab 8: SE-2030 Dr. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 8

Generalization is a form of Inheritance that indicates that a class (statically) inherits behavior defined and implemented in another class SE-2030 Dr. Mark L. Hornick 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. Mark L. Hornick 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. Mark L. Hornick 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.