Download presentation
Presentation is loading. Please wait.
Published byAmi Anthony Modified over 9 years ago
1
COP 4331 OO Processes for Software Development Lab1 © Dr. David A. Workman School of EE and Computer Science University of Central Florida May 11, 2005 January 21, 2007
2
January 8, 2007(c) Dr. David A. Workman2 UML Concepts and Notation Name Attributes (private) Operations (public) Respon- sibilities (public) ClassActive Class Name Packages Textual content Note Action Use case Actor Analysis Entity Class Analysis Boundary Class Analysis Control Class Relationships Association Dependency or Flow Refinement Generalization Composition Aggregation Component Name Attributes (private) Operations (public) Respon- sibilities (public) Name class 1 * 0..1 m..n exactly one zero or more optional bounded range { constraint }« stereotype »
3
January 8, 2007(c) Dr. David A. Workman3 Figure 1 #include “AppError.h” namespace Object { // Declare C++ functions representing methods of the namespace object. // At least one of these function must always be defined to properly initialize // the object’s environment before any other method can be called. These // initialization functions serve the same purpose as constructors of a class // type. The default initialization method is declared below. void Initialize(); } Object.h #include “Object.h” namespace Object { } Object.cpp void Initialize() { } Define encapsulated data members here. Primitive data can be directly initialized. Data members of a Class type should be defined as pointers and intialized by the initialization method(s). Define the bodies of the functions declared in the header file. The bodies are defined using The same syntax you would use for functions in C, but they have direct visibility to all data members defined at the top of the namespace.
4
January 8, 2007(c) Dr. David A. Workman4 Figure 2 #include “Object.h” int main() { …. Object::Initialize(); // Call Object initialization fn … Object::Function1(…); // Call Object procedure … x = Object::Function2(…); // Call Object function }
5
January 8, 2007(c) Dr. David A. Workman5 Figure 3 Soda Delivery Port Soda Menu & Selection Buttons Access Lock for restocking Digital Display Coin Input Slot Coin Return Port Paper Bill Input Scanner
6
January 8, 2007(c) Dr. David A. Workman6 Vending Machine Simulator File System Sim User Initialize Machine Execute Command Restock VM Purchase Beverage Dispense Beverage Present VM State > Sim User
7
January 8, 2007(c) Dr. David A. Workman7 Vending Machine Consumer Restock VM Purchase Beverage Dispense Beverage Service Guy Interaction Interface includes state of all VM boundary objects; for example, Money display, Coin return, Beverage return, Select buttons, Beverage prices.
8
January 8, 2007(c) Dr. David A. Workman8 Use Case Flow Initialize Machine Execute Command Restock VM Purchase Beverage Dispense Beverage Present VM State [exit] [restock] [Dispense] [Purchase]
9
January 8, 2007(c) Dr. David A. Workman9 System State Model StartCommand Initialize VM Restock Dispense Pay exit Halt
10
January 8, 2007(c) Dr. David A. Workman10 State Transition Models (Active Objects) Behavior Mode Start [C 1 ] Event/[C 2 ]Action [C 1 ] an [optional] boolean precondition that must be true before Event can trigger a transition; no precondition implies the transition will occur unconditionally whenever the Event occurs in the system. [C 2 ] an [optional] boolean precondition that must be true before Action will be executed whenever the transition occurs ; no precondition implies Action will be executed unconditionally whenever the transition occurs. Event: a signal or message received that can potenitally trigger a change in state and/or precipitate an action. Action: a computation performed in response to an event that triggers a state transition; in a simulation, this computation typically sends messages to other Agents. State: an activity or behavior mode that will continue until the next event; an activity could be a state of idleness. Stop [C 1 ] Event/[C 2 ]Action
11
January 8, 2007(c) Dr. David A. Workman11 Use Case: Restock VM Service Guy 1: unlock 7: lock Front Panel Access Lock 2: open 6: close Front Panel Door Beverage Rack *4: Fill with Coin [i] (quant) Coin Dispenser *3: Fill with Bev [i] (quant) 5: Empty Coin Catch Bucket restock unlock Bev[i] [1] = (Bev[i] < BevMax[i]-1) [2] = (Bev[i] = BevMax[i]) [3] = (Coin[i] < CMax[i] – 1) [4] = (Coin[i] = CMax[i]) [5] = ~(Catch Bucket Empty) [1] Add Bev[i] /Bev[i]++ [1] Add Bev[i] /Bev[i]++ (~[1]) Add Bev[i] /Bev[i]++ [2] Add Bev[i] [4] Add Coin[i] Restock Error Coin[i] [3] Add Coin[i] /Coin[i]++ [3] Add Coin[i] /Coin[i]++ (~[3]) Add Coin[i] /Coin[i]++ (~[1]&~[2]) Add Bev[i]/Bev[i]++ (~[3]&~[4]) Add Coin[i]/Coin[i]++ [5] Empty Catch Bucket lock Restock Error other Transition Conditions
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.