Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.

Slides:



Advertisements
Similar presentations
Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Advertisements

UML (Sequence Diagrams, Collaboration and State Chart Diagrams) Presentation By - SANDEEP REDDY CHEEDEPUDI (Student No: ) - VISHNU CHANDRADAS (Student.
Unit 1: Java and Eclipse UML. Depending on the source, the acronym UML is said to stand for “unified modeling language” or “universal modeling language”.
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.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 Architectural Modeling Notations.
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.
THE OBJECT-ORIENTED DESIGN WORKFLOW UML2 Sequence Diagrams.
Essentials of interaction diagrams Lecture 23 & 24.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
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.
Chapter 10 Classes Continued
UML a crash course Alex Lo Brian Kiefer. Overview Classes Class Relationships Interfaces Objects States Worksheet.
SE-565 Software System Requirements More UML Diagrams.
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
Unified Modeling Language
Object-Oriented Analysis and Design
COMS W4156: Advanced Software Engineering
1 Object-Oriented Programming (Java), Unit 15 Kirk Scott.
UML for Java Programmers Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Interaction diagrams Sequence and collaboration diagrams.
Unit 4 Prototype Summary prepared by Kirk Scott 1.
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
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,
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
© 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.
An Introduction to the Unified Modeling Language
SE-1020 Dr. Mark L. Hornick 1 Composition, Aggregation, and Inheritance - Introduction.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
Class Diagram. Classes Software Design (UML) Class Name attributes operations A class is a description of a set of objects that share the same attributes,
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Object Oriented Analysis and Design Class and Object Diagrams.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Chapter 3 Class Diagrams. 2 Outline Class Basics Class Basics Classes Classes Association Association Multiplicity Multiplicity Inheritance Inheritance.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Chapter 16: UML Class Diagrams
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
INFO 620Lecture #71 Information Systems Analysis and Design Design Class Diagrams and others INFO 620 Glenn Booker.
Chapter 3: Introducing the UML
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.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
1 Kyung Hee University Interaction Diagrams Spring 2001.
Chapter 1 Overview of UML for Java Programmers. 2 Outline Diagram Types Diagram Types Class Diagrams Class Diagrams Object Diagrams Object Diagrams Sequence.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Appendix 3 Object-Oriented Analysis and Design
CHAPTER
Course Outcomes of Object Oriented Modeling Design (17630,C604)
Objects as a programming concept
Unified Modeling Language—UML A Very Brief Introduction
UML dynamic Modeling (Behavior Diagram)
Object Oriented Analysis and Design
Systems Analysis and Design With UML 2
Week 12: Activity & Sequence Diagrams
CIS 375 Bruce R. Maxim UM-Dearborn
Object Oriented Programming in java
CIS 375 Bruce R. Maxim UM-Dearborn
Object Oriented System Design Class Diagrams
The generalization of class
Presentation transcript:

Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1

UML Notation for Classes First, a UML diagram is given Following that, the features it illustrates will be noted point by point 2

3

Draw a class by centering its name in a rectangle Note that UML doesn’t require that everything be shown in a diagram Not all methods of a class need be listed, etc. The diagram can be selective, showing only what’s necessary to explain the topic at hand 4

Indicate a package by putting its name in a “tab” at the upper left of a rectangle which contains the elements (classes, etc.) of the package If a class belongs to a package, but the package itself is not diagrammed as a tabbed rectangle, the class’s name can include the package name using dot notation: packagename.classname 5

Class diagrams can show instance variables in a second rectangle, below the one with the name Give the name of the variable, followed by a colon, followed by a type 6

Class diagrams can show (constructors and) methods in a third rectangle, below the one with the instance variables A listing of a method would include its name and a pair of parentheses If the method takes a parameter, within the parentheses the name of the parameter would be given, followed by a colon, followed by its type If the method returns a value, the parentheses are followed by a colon, which is followed by the type of the return value 7

Both instance variables and methods can be marked to indicate what access modifier they have Private things are preceded with a “-” Public things are preceded with a “+” Protected things are preceded with a “#” 8

Static methods are indicated by underlining In addition, static methods can noted using dot notation, giving the name of the class, followed by a colon, followed by the method signature 9

Notes can be added by drawing a dashed line from the item in question to a dog-eared rectangle Notes can be code, constraints, or comments Notes can be used wherever needed or desired in a UML diagram 10

Class Relationships First, a UML diagram is given Following that, the features it illustrates will be noted point by point 11

12

Italicize the names of things that are declared abstract, like methods and the classes that contain them Underline the names of static methods In general, the relationships between classes are indicated by lines Whether the lines are dashed, and what kind of symbol they have on the end, indicate what the relationship is 13

Use an undashed line and a closed, hollow arrowhead to point from a subclass to its superclass Use an undashed line with a diamond to indicate that one or more instances of one class contain one or more instances of another The lines can be labeled with numbers indicating the cardinality of each end of the relationship A white or black diamond determines whether this is aggregation of composition Under composition, the parts can’t exist without the whole 14

A line, in general, indicates some relationship between classes If two classes are connected by a simple line, this would indicate that one of the classes has an instance of the other as an instance variable In order to make this clear, a reference from one class to an instance of another is indicated with an undashed line with an open arrowhead The official term for this is navigability, the object referred to is reachable through the code of the object which refers to it 15

Classes may also have dependencies that are not determined by an object reference Such dependencies are shown with a dashed line and an open arrowhead The book illustrates such a dependency with a class that calls a static method of another class A dashed line with an open arrowhead can also be used to indicate the throwing of an exception, with the arrow point from the throwing class to the exception class 16

Interfaces First, a UML diagram is given Following that, the features it illustrates will be noted point by point 17

18

You can show an interface by drawing a rectangle and labeling it with the name of the interface in European quotation marks A dashed line with a closed, white arrowhead from a class to an interface shows that the class implements the interface 19

In order to prevent a nightmare of criss-crossing lines in a diagram, the fact that a class implements an interface can be indicated by a short line from it to a small circle (a lollipop) labeled with the interface name The book states, “Interfaces and their methods are always abstract in Java. Oddly enough, interfaces and their methods do not appear in italics, unlike abstract classes and abstract methods in classes.” Note that logically you could rewrite the book’s statement by observing that if interfaces and methods are always effectively abstract, then there is no need to indicate that with italics or other notation. It is understood. 20

Objects First, a UML diagram is given Following that, the features it illustrates will be noted point by point 21

22

An object is represented by rectangle containing the name of the object More completely, it could be given as object name, colon, class name In the case of an unnamed object, it can be labeled with a colon followed by the class name Whatever naming convention is used, the name should be underlined 23

A line between two objects shows that one has a reference to the other Just like with this notation in classes, it should be a solid line with an open arrowhead going from the one having the reference to the one referred to 24

Static structure diagrams typically show the relationships between classes Sequence diagrams show the relationships between objects, namely the calls between them, at run time Note that sequence diagrams can go all the way down to the method level (as pointed out in CS 202), but this book doesn’t cover that 25

When doing sequence diagrams, each object has a dashed life-line, a dashed vertical line where time runs from top to bottom The calls from one object to another are indicated by solid lines with solid black arrowheads from the life-line of one object to the life-line of another In UML terminology, the calls are known as one object “sending a message” to another The lines are labeled with the name of the method called 26

One object creating another is shown using similar notation A solid line with a solid black arrowhead runs from the life-line of the creating object to the rectangle representing the created one This arrow is labeled with what is known as a stereotype, the word “create” in European quotation marks 27

The last point on this topic is rather obscure In other words, we will never have a use for it in this course If the box representing an object is bold-faced, this means that the object is active in a thread, process, or computer other than the one in which the other objects in the diagram are active In other words, this is a way of indicating remote calls, for example 28

States First, a UML diagram is given Following that, the features it illustrates will be noted point by point 29

30

A state is given as a rectangle with rounded corners containing the name of the state Transitions between states are given as open arrows labeled with the name of the transition State charts do not necessarily map directly to a class or object diagram in particular application code, although this is possible This will come up in chapter 22 on the State design pattern 31

The End 32