Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.

Slides:



Advertisements
Similar presentations
1 Object-oriented design Part 2: OO tools & UML. 2 CRC cards Design tool & method for discovering classes, responsibilities, & relationships Record on.
Advertisements

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Inheritance Inheritance Reserved word protected Reserved word super
Object Oriented Programming Chapter 7 Programming Languages by Ravi Sethi.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Object-Oriented Analysis and Design
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
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.
Unified Modeling Language (UML)
1 SWE Introduction to Software Engineering Lecture 15 – System Modeling Using UML.
Dynamic modeling using UML
UML Sequence Diagrams Eileen Kraemer CSE 335 Michigan State University.
SE-565 Software System Requirements More UML Diagrams.
1 Lab Beginning Analysis and Design 4 Completion of first version of use case diagram initiates the processes of analysis and design. 4 UML provides.
Unified Modeling Language
Object-Oriented Analysis and Design
UML for Java Programmers Object Mentor, Inc. Copyright  by Object Mentor, Inc All Rights Reserved
Chapter 2 (Horstmann’s Book) – Part 2 The Object-Oriented Design Process Hwajung Lee.
Object-Oriented Design & Patterns Cay S
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Interaction diagrams Sequence and collaboration diagrams.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 25. Review Design Level Class Diagram Identifying classes/Operations/Attributes Associations – Simple associations.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
1 Modeling interactions and behavior Lecturer Dr. Mai Fadel.
Inheritance - Polymorphism ITI 1121 Nour El Kadri.
UML diagrams What is UML UML diagrams –Static modeoing –Dynamic modeling 1.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.
Course Instructor: Kashif Ihsan 1. Chapter # 3 2.
Interaction Diagrams Interaction Diagrams allow the designer to show how groups of objects collaborate in some behavior. –Interaction Diagrams will show.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 8: Modelling Interactions and Behaviour UML Sequence Diagram.
Object Oriented Analysis and Design Sequence Diagrams.
CS 151: Object-Oriented Design September 5 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
1 Class responsibilities & relationships. 2 Responsibilities Responsibilities describe a class’s purpose in terms of its functionality Responsibilities.
Karolina Muszyńska Based on: S. Wrycza, B. Marcinkowski, K. Wyrzykowski „Język UML 2.0 w modelowaniu SI”
ITEC324 Principle of CS III Chapter 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Object Oriented Programming
 Building Block Building Block  Things in the UML Things in the UML  Structural Things Structural Things  Behavioral Things Behavioral Things  Grouping.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Object-Oriented Application Development Using VB.NET 1 Chapter 5 Object-Oriented Analysis and Design.
Chapter 3: Introducing the UML
POLYMORPHISM Chapter 6. Chapter Polymorphism  Polymorphism concept  Abstract classes and methods  Method overriding  Concrete sub classes and.
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 2 (Horstmann’s Book) – Part 1 The Object-Oriented Design Process Hwajung Lee.
Project 2: Phase 1 Submission 7 Late submissions 10% 10 No submissions 14% Better than project 1 phase 3 submissions 10-point bonus: If you catch the deadline.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Sequence Diagram Lecture # 1. Sequence Diagram Definition A Sequence diagram is an interaction diagram that shows how the objects and classes involved.
UML Diagrams By Daniel Damaris Novarianto S..
Unified Modeling Language Tutorial
The Movement To Objects
Unified Modeling Language (UML)
7.1 What Is An Object Object-oriented program - Description or simulation of application Object-oriented programming is done by adopting or extending an.
Standard UML: Communication and Dynamic Behavior
Interface, Subclass, and Abstract Class Review
UML Diagrams Jung Woo.
Classification of UML Diagrams
Week 12: Activity & Sequence Diagrams
CIS 375 Bruce R. Maxim UM-Dearborn
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
CIS 375 Bruce R. Maxim UM-Dearborn
ITEC324 Principle of CS III
ITEC324 Principle of CS III
Presentation transcript:

Object-oriented design Part 4: More UML

Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces provide some of the same functionality –A Java class can only inherit from one class –But can implement many interfaces

ATM Example This hierarchy chart represents the ATM device classes as envisioned by the preliminary design Each of the concrete subclasses represents an actual physical device; the abstract classes are used to abstract their common behavior The design calls for Bank Card Reader and Receipt Printer to inherit from multiple superclasses, but this can’t be done in Java

Using Interfaces Instead of redoing the design, can make the abstract classes into interfaces An interface specifies, but does not implement, specific methods; the implementation is left up to the subclasses that “inherit” the interface

Inheritance vs. Interfaces We can think of “real” inheritance as implementation inheritance –Subclasses inherit and may extend functionality of superclass –Superclasses pass on structure and behavior

Inheritance vs. Interfaces Interfaces provide only definition inheritance –Methods may be specified, but there is no superclass implementation –Instead, the subclasses define what is specified in the interface –Interfaces pass on structure, but not behavior

Interfaces & UML Interface relationships look like inheritance relationships, except a dashed line is used for connecting subclasses to superclasses Each interface’s name is enclosed in a double set of angle brackets: >

ATM Example

Dependency Dashed lines with closed arrowheads, as shown in the previous diagram, indicate definition inheritance via interfaces A dashed line with an open arrowhead simply indicates a dependency - that is, one class depending on another to fulfill a responsibility

Dependency example In a previous lecture, we looked at the fact that Java doesn’t allow for operator overloading, which can complicate I/O tasks with dependencies The example below illustrates such a dependency; the Obj class contains a method that prints data to the screen, forcing reliance on two classes from the Java API, System and PrintStream

Sequence Diagrams Sequence diagrams describe the interaction of classes as their methods are called Where class diagrams provide a static picture of class relationships (basically just telling us that a relationship exists), sequence diagrams provide a dynamic picture of a system in action Time is represented by the vertical dimension; the further down in the diagram, the later a method is invoked

Elements of a sequence diagram Rectangles representing classes and objects –object names are underlined, and may appear in several forms: full description: objectname: Classname no class specified: objectname class specified without object name; read as “some instance of this class”: : Classname –class names are not underlined Method names and other text

Elements of a sequence diagram Lifelines: dashed vertical lines representing the period of time during which an object exists (can be left indeterminate) Activation bars: rectangles laid over lifelines, representing a method’s execution in process Call arrows: horizontal arrows pointing from the calling object or class to the object or class that owns the called method

Elements of a sequence diagram Data tokens: short lines with an arrowhead on one end and a circle on the other, representing data items flowing between objects –Tokens pointing to the right represent arguments passed to methods –Tokens pointing the left represent return values

Sequence diagram: example 1 aMailbox is the calling object - calls MessageQueue.add(message)

Sequence diagram: example 2 This diagram represents a self call: the unnamed MailSystem object is calling its own locat box method

Sequence diagram: example 3 In this diagram, the MailSystem object calls the constructor for a Mailbox object. The > stereotype indicates the constructor call; note that the Mailbox object is slightly below the MailSystem object, because its lifeline doesn’t start until MailSystem creates it

Sequence diagram: example 4 Each key press results in separate call to dial, but only one is shown Connection must find mailbox object: Call findMailbox on MailSystem object Connection wants to get greeting to play: Each mailbox knows its greeting Parameters and return values are not displayed in this diagram Note that connection holds on to that mailbox over multiple calls

State diagrams Some objects have a discrete set of states that affect their behavior; this is particularly true of objects that interact with the user A state diagram shows the various states of a system while a particular process is carried out State diagrams can be used to illustrate variations in a use case

State diagram example - ATM

State diagram example - voice mail system