Chapter 20 Applying UML and Patterns Craig Larman

Slides:



Advertisements
Similar presentations
PHP functions What are Functions? A function structure:
Advertisements

Object Design Examples with GRASP
Visibility Larman, Chapter 19 (with ideas from George Blank of NJIT) CSE432 Object Oriented Software Engineering.
Subprogram Control - Data sharing Mechanisms to exchange data Arguments - data objects sent to a subprogram to be processed. Obtained through  parameters.
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.
Object Oriented Programming Chapter 7 Programming Languages by Ravi Sethi.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Fall 2009AXS-3913 Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 219 Bell Hall
Copyright W. Howden1 Lecture 7: Functional and OO Design Descriptions.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
NJIT More GRASP Patterns Chapter 22 Applying UML and Patterns Craig Larman Prepared By: Krishnendu Banerjee.
Oct Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
NJIT Designing for Visibility Chapter 19 Applying UML and Patterns Craig Larman.
November Ron McFadyen Visibility Visibility: the ability of one object to see or have a reference to another object. e.g. When a register object.
Object-Oriented Analysis and Design
Comparison of OO Programming Languages © Jason Voegele, 2003.
INTRODUCTION TO PROGRAMMING STRUCTURE Chapter 4 1.
BPJ444: Business Programming Using Java Classes and Objects Tim McKenna
SOEN 6011 Software Engineering Processes Section SS Fall 2007 Dr Greg Butler
Design Class Diagrams (DCDs)
Chapter 16 Applying UML and Patterns Craig Larman
© 2005 Prentice Hall9-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
CPS120: Introduction to Computer Science Functions.
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
IntellAgile Copyright © 2002 Craig Larman. All rights reserved. Object Design and Use- Case Realizations with GRASP Patterns.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Information Systems Engineering
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Programming Perl in UNIX Course Number : CIT 370 Week 6 Prof. Daniel Chen.
CS451 - Lecture 2 1 CS451 Lecture 2: Introduction to Object Orientation Yugi Lee STB #555 (816) * Acknowledgement:
Functions in C CSE 2451 Rong Shi. Functions Why use functions? – Reusability Same operation, different data – Abstraction Only need to know how to call.
1 Chapter 5: Defining Classes. 2 Basics of Classes An object is a member of a class type What is a class? Fields & Methods Types of variables: –Instance:
Object-Oriented Analysis and Design Week 11, 2009.
Chapter 16: UML Class Diagrams
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
Use-Case Model: Adding Detail with Operation Contracts.
Chapter 7 - Functions. Functions u Code group that performs single task u Specification refers to what goes into and out of function u Design refers to.
Design Model: Determining Visibility CH-18. Objectives Identify four kinds of visibility. Design to establish visibility. Illustrate kinds of visibility.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Lesson 3 Functions. Lesson 3 Functions are declared with function. For example, to calculate the cube of a number function function name (parameters)
Classes (Part 1) Lecture 3
Class and Objects UNIT II.
7.1 What Is An Object Object-oriented program - Description or simulation of application Object-oriented programming is done by adopting or extending an.
By Muhammad Waris Zargar
Object-Oriented Programming: Classes and Objects
GRASP: Visibility and Design
Chapter 11: Collaboration Diagram - PART1
Chapter 5: Object Oriented Analysis and Design
Structures Revisited what is an aggregate construct? What aggregate constructs have we studied? what is a structure? what is the keyword to define a structure?
Using local variable without initialization is an error.
Requirements To Design In This Iteration
Functions BIS1523 – Lecture 17.
Corresponds with Chapter 7
Chapter 10: Visibility Chapter 18 in Applying UML and Patterns Book.
Chapter 4 (part 2).
Object-Oriented Programming Using C++ Second Edition
UNIT I OBJECT ORIENTED PROGRAMMING FUNDAMENTALS
Ruby Classes.
Tonga Institute of Higher Education
Chapter 16 UML Class Diagrams
Object Oriented System Design Class Diagrams
CS 1054: Lecture 2, Chapter 1 Objects and Classes.
Presentation transcript:

Chapter 20 Applying UML and Patterns Craig Larman Visibility Chapter 20 Applying UML and Patterns Craig Larman

Objectives Identify four kinds of visibility Design to establish visibility Illustrate kinds of visibility in the UML notation

Introduction Q. What is visibility? A. Visibility is the ability of one object to see or have reference to another.

Visibility Between Objects Q. When is visibility necessary? A. To send a message from one object to another, the receiver object must be visible to the sender, so the sender has to have a pointer or reference to the receiver.

Visibility Between Objects Example: Q. If A sends messages to B, which must be visible to which? A. B is visible to A means A can send a message to B. Some say that "B is an acquaintance of A".

Visibility Between Objects

Visibility Visibility is related to the scope: Is one resource (such as an instance) within the scope of another? The motivation to consider visibility: For an object A to send a message to an object B, B must be visible to A.

Four Kinds of Visibility How visibility can be achieved from object A to object B: Attribute visibility - B is an attribute of A Parameter visibility - B is a parameter of a method of A Local visibility - B is a local object in a method of A Global visibility - B is in some way globally visible

Attribute Visibility Attribute visibility from A to B exists when B is an attribute of A Relatively permanent visibility because it persists as long as A and B exist Common form of visibility public class Register {… private ProductCatalog Catalog; … }

Attribute Visibility

Parameter Visibility Parameter visibility from A to B exists when B is passed as a parameter to a method of A. Relatively temporary visibility because it persists only within the scope of the method The 2nd most common form of visibility in the OO systems

Parameter Visibility

Parameter to attribute Visibility It is common to transform parameter visibility into attribute visibility.

Local Visibility Local visibility from A to B exists when B is declared as a local object within a method of A. Relatively temporary visibility since it persists only within the scope of the method.

Local Visibility There are two common means by which local visibility is achieved: Create a new local instance and assign it to a local variable. Assign the returning object from a method invocation to a local variable. A variation of this method does not explicitly declare a variable, but one implicitly exists as the result of a returning object from a method invocation Ex: anObject.getAnotherObject.doSomething();

Global Visibility Global visibility from A to B exists when B is global to A. Relatively permanent visibility since it persists as long as A and B exist. The least common form of visibility in OO Systems.

Example

Visibility in the UML Public: Any outside classifier with visibility to the given classifier can use the feature; specified by pre-pending the symbol “+” Protected: Any descendant of the classifier can use the feature; specified by pre-pending the symbol “#” Private: Only the classifier itself can use the feature; specified by pre-pending the symbol “-”