 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range.

Slides:



Advertisements
Similar presentations

Advertisements

Object-Oriented Analysis and Design CHAPTERS 15: UML INTERACTION DIAGRAMS 1.
UML (Sequence Diagrams, Collaboration and State Chart Diagrams) Presentation By - SANDEEP REDDY CHEEDEPUDI (Student No: ) - VISHNU CHANDRADAS (Student.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
5 5 Arrays. OBJECTIVES In this lecture we will learn:  Case switch  To use the array data structure to represent a set of related data items.  To declare.
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2003 Prentice Hall, Inc. All rights reserved. 1 Arrays –Structures of related data items –Static entity (same size throughout program) A few types –Pointer-based.
Dynamic modeling using UML
Sequence Diagram. What is Sequence Diagram?  Sequence Diagram is a dynamic model of a use case, showing the interaction among classes during a specified.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved Arrays and Vectors.
 2006 Pearson Education, Inc. All rights reserved Arrays and Vectors.
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.
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.
SEQUENCE DIAGRAM Prepared by: T. Fatimah Alageel.
CS3773 Software Engineering
UML Collaboration Diagram. Recap System Sequence Diagrams (SSD) UML for SSD Examples.
Interaction diagrams Sequence and collaboration diagrams.
UML / UML 2.0 Diagrams (Part III) 1. Sequence diagram is the most common kind of interaction diagram. It focuses on the message interchange between a.
 2006 Pearson Education, Inc. All rights reserved Arrays.
Chapter 5 – System Modeling
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Wage Calculator Application: Introducing.
1 Sequence Diagrams (Based on Stevens and Pooley (2006, Chapters 9, 10) and Fowler (2004, Chapter 4)) David Meredith Aalborg University.
Interaction Models (2): Sequence Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 1.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML Sequence Diagrams.
Smith’s Aerospace © P. Bailey & K. Vander Linden, 2005 Interaction and Communication Diagrams Patrick Bailey Keith Vander Linden Calvin College.
Sequence diagram in UML Martin Palkovik. Sequence diagram  It is a graphic representation of system operations based on chronology - a time sequence.
 2008 Pearson Education, Inc. All rights reserved Arrays and Vectors.
Discovering object interaction. Use case realisation The USE CASE diagram presents an outside view of the system. The functionality of the use case is.
Information Systems Engineering Interaction Diagrams: Sequence Diagram Collbortion Diagram.
1 An Introduction to UML Interaction (Sequence and Communication) Diagrams Georgia State University CIS 3300 Spring, 2009.
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 1 Mira Balaban & Arnon Sturm Object-Oriented Analysis and Design Session 3a: Behavioral Modeling - Interactions.
Object Oriented Analysis and Design Sequence Diagrams.
1 Arrays and Vectors Chapter 7 Arrays and Vectors Chapter 7.
Collaboration diagrams. Purpose A collaboration diagram is an alternate way to show a scenario. A collaboration diagram shows the objects and relationships.
CS212: Object Oriented Analysis and Design Lecture 34: UML Activity and Collaboration diagram.
 2003 Prentice Hall, Inc. All rights reserved. 1 Vectors.
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
Sequence Diagram SAD ::: Fall 2015 Sabbir Muhammad Saleh.
 The Sequence Diagram models the collaboration of objects based on a time sequence.  It shows how the objects interact with others in a particular scenario.
1 Kyung Hee University Interaction Diagrams Spring 2001.
 2005 Pearson Education, Inc. All rights reserved Arrays.
 2008 Pearson Education, Inc. All rights reserved Arrays and Vectors.
 2006 Pearson Education, Inc. All rights reserved Arrays and Vectors.
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.
Sequence Diagram Lecture # 1. Sequence Diagram Definition A Sequence diagram is an interaction diagram that shows how the objects and classes involved.
Unified Modeling Language (UML)
7 Arrays and Vectors.
Object-Oriented Systems Analysis and Design Using UML
Prepared By Sidra Noureen
Sequence Diagram.
UML Sequence Diagrams.
Vectors.
Week 12: Activity & Sequence Diagrams
4.9 Multiple-Subscripted Arrays
Introduction to Classes and Objects
7. 11 Introduction to C++ Standard Library Class Template vector (Cont
Interaction diagrams Interaction diagrams are models that describe how groups of objects collaborate in some behavior. Typically, an interaction diagram.
UML Interaction diagrams
7 Arrays.
7 Arrays and Vectors.
7 Arrays and Vectors.
Vectors.
4.1 Introduction Arrays A few types Structures of related data items
Presentation transcript:

 C-style pointer-based arrays  Have great potential for errors and several shortcomings  C++ does not check whether subscripts fall outside the range of the array  Two arrays cannot be meaningfully compared with equality or relational operators  One array cannot be assigned to another using the assignment operators 1

 Class template vector  Available to anyone building applications with C++  Can be defined to store any data type  Specified between angle brackets in vector  All elements in a vector are set to 0 by default  Member function size obtains size of array  Number of elements as a value of type size_t  vector objects can be compared using equality and relational operators  Assignment operator can be used for assigning vector s 2

 vector elements can be obtained as an unmodifiable lvalue or as a modifiable lvalue  Unmodifiable lvalue  Expression that identifies an object in memory, but cannot be used to modify that object  Modifiable lvalue  Expression that identifies an object in memory, can be used to modify the object 3

 vector member function at  Provides access to individual elements  Performs bounds checking  Throws an exception when specified index is invalid  Accessing with square brackets does not perform bounds checking 4

5 Outline fig07_26.cpp (1 of 6) Using const prevents outputVector from modifying the vector passed to it These vector s will store int s Function size returns number of elements in the vector

6 Outline fig07_26.cpp (2 of 6) Comparing vector s using != Copying data from one vector to another Assigning data from one vector to another

7 Outline fig07_26.cpp (3 of 6) Comparing vector s using == Updating a value in the vector Function at provides bounds checking Displaying a value in the vector

8 Outline fig07_26.cpp (4 of 6) Input vector values using cin Display each vector element

9 Outline fig07_26.cpp (5 of 6)

10 Outline fig07_26.cpp (6 of 6) Call to function at with an invalid subscript terminates the program

 Collaborations  When objects communicate to accomplish task  One object sends a message to another object  Accomplished by invoking operations (functions)  Identifying the collaborations in a system  Read requirements document to find  What ATM should do to authenticate a user  What ATM should do to perform transactions  For each action, decide  Which objects must interact  Sending object  Receiving object 11

12

 Interaction Diagrams  Model interactions using UML  Communication diagrams  Also called collaboration diagrams  Emphasize which objects participate in collaborations  Sequence diagrams  Emphasize when messages are sent between objects 13

 Communication diagrams  Objects  Modeled as rectangles  Contain names in the form objectName : className  Objects are connected with solid lines 14

 Communication diagrams (Cont.)  Messages are passed along these lines in the direction shown by arrows  Synchronous calls – solid arrowhead  Sending object may not proceed until control is returned from the receiving object  Asynchronous calls – stick arrowhead  Sending object does not have to wait for the receiving object  Name of message appears next to the arrow 15

16

 Communication diagrams (Cont.)  Sequence of messages in a communication diagram  Indicated by the number to the left of a message name  Indicate the order in which the messages are passed  Process in numerical order from least to greatest  Nested messages are indicated by decimal numbering  Example  First message nested in message 1 is message

18

 Sequence diagrams  Help model the timing of collaborations  Lifeline  Dotted line extending down from an object’s rectangle  Represents the progression of time (top to bottom)  Activation  Thin vertical rectangle on an object’s lifeline  Indicates that the object is executing 19

 Sequence diagrams (Cont.)  Sending messages  Similar to communication diagrams  Solid arrow with filled arrowhead indicates a message  Points to the beginning of an activation  Dashed line with stick arrowhead indicates return of control  Extends from the end of an activation 20

21

22