March 200491.3913 R McFadyen1 Activity Diagrams Used to present the procedural steps of an algorithm An algorithm comprises any of the following structures:

Slides:



Advertisements
Similar presentations
Canning Foods Presentation by Andrew Meador 8:20 Appalachian History.
Advertisements

Activity Diagrams in UML. Definition Activity diagrams represent the dynamics of the system. They are flow charts that are used to show the workflow of.
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC Lecture two Dr. Hamdy M. Mousa.
8-May-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
COMP 14 Introduction to Programming Miguel A. Otaduy May 21, 2004.
5-1 Flow of Control Recitation-01/25/2008  CS 180  Department of Computer Science  Purdue University.
16-Jun-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts and Debugging.
Flowcharts Remember that a solution to a problem is called an algorithm. Algorithms are often a series of steps required to solve the problem. A flowchart.
March R McFadyen1 Activity Diagrams start end branch merge fork join guard transition swimlanes activity Used to present procedural steps (algorithm)
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
Activity Diagrams. What is Activity Diagrams?  Activity diagrams are a technique to describe procedural logic, business process, and work flow.  An.
March R McFadyen1 Activity Diagrams Used to present the procedural steps of an algorithm An algorithm comprises any of the following structures:
Computer Programming 1 Repetition. Computer Programming 2 Objectives Repetition structures Study while and do loops Examine for loops A practical example.
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
Requirements Analysis Activity Diagrams b511.ppt © Copyright De Montfort University 2000 All Rights Reserved INFO2005 Requirements Analysis.
COMP 110 Introduction to Programming Mr. Joshua Stough September 24, 2007.
Control Structures II. Why is Repetition Needed? There are many situations in which the same statements need to be executed several times. Example: Formulas.
 Decision making statements Decision making statements if statement if...else statement Nested if...else statement (if...elseif....else Statement) 
Extended Prelude to Programming Concepts & Design, 3/e by Stewart Venit and Elizabeth Drake Chapter 2: Flowcharts.
Interaction Models (2): Sequence Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh 1.
Activity diagrams. Introduction ● Activity diagrams are a behavioural model that represent the dynamics of the system. ● An activity diagram is essentially.
1 09/20/04CS150 Introduction to Computer Science 1 Let ’ s all Repeat Together.
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
Object Oriented Programming Lecture 4: Flow Control Mustafa Emre İlal
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 4 - Control Structures: Part 1.
Control Structures II: Repetition.  Learn about repetition (looping) control structures  Explore how to construct and use count-controlled, sentinel-controlled,
1-Dec-15 Additional control structures. 2 The if-else statement The if-else statement chooses which of two statements to execute The if-else statement.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
Chapter 7 Appendix B Object-Oriented Analysis and Design: Activity Diagrams Modern Systems Analysis and Design Seventh Edition Jeffrey A. Hoffer Joey F.
A Student Guide to Object-Oriented Development
(C)opyright 2000 Scott/Jones Publishers Introduction to Flowcharting.
CONTROL STATEMENTS LOOPS. WHY IS REPETITION NEEDED?  There are many situations in which the same statements need to be executed several times.  Example:
Application development with Java Lecture 6 Rina Zviel-Girshin.
CONTROL STRUCTURE Chapter 3. CONTROL STRUCTURES ONE-WAY SELECTION Syntax: if (expression) statement Expression referred to as decision maker. Statement.
CSI 3125, Preliminaries, page 1 Control Statements.
 2003 Prentice Hall, Inc. All rights reserved. 1 Will not cover 4.14, Thinking About Objects: Identifying Class Attributes Chapter 4 - Control Structures.
R McFadyen Activity Diagrams Activity diagrams are used to present the procedural steps of an algorithm An algorithm comprises any of the following.
Beginning C For Engineers Fall 2005 Lecture 3: While loops, For loops, Nested loops, and Multiple Selection Section 2 – 9/14/05 Section 4 – 9/15/05 Bettina.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Chapter 2: Fundamental Programming Structures in Java Adapted from MIT AITI Slides Control Structures.
Activity Diagramming by Andrzej Rosolski Stanisław Gliniewicz.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 5 Control Structures II: Repetition.
Interaction Models (2): Activity Diagrams Extracted from textbook: Object Oriented Modeling and Design with UML M. Blaha, J. Rumbaugh.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
CC213 Programming Applications Week #2 2 Control Structures Control structures –control the flow of execution in a program or function. Three basic control.
Flow Charts And Pseudo Codes Grade 12. An algorithm is a complete step-by- step procedure for solving a problem or accomplishing a task.
Loops ( while and for ) CSE 1310 – Introduction to Computers and Programming Alexandra Stefan 1.
UCT Department of Computer Science Computer Science 1015F Iteration
Program design Program Design Process has 2 phases:
Activity Diagrams.
CS1010 Programming Methodology
Chapter 5: Control Structures II
C++ Programming: CS150 For.
Chapter 5: Control Structures II
Activity and State Transition Diagram
Activity Diagram.
Repetition-Counter control Loop
CiS 260: App Dev I Chapter 4: Control Structures II.
Repetition-Sentinel,Flag Loop/Do_While
Activity Diagrams.
Chapter 5: Control Structures II
Loops CS140: Introduction to Computing 1 Savitch Chapter 4 Flow of Control: Loops 9/18/13 9/23/13.
Control Structure Senior Lecturer
Use Case Modeling - techniques for detailing use cases
Process Modeling: Activity/Swimlane Diagrams
Structured Program Development in C
Object-Oriented Analysis and Design: Activity Diagrams
Object-Oriented Analysis and Design: Activity Diagrams
Control Statements:.
Presentation transcript:

March R McFadyen1 Activity Diagrams Used to present the procedural steps of an algorithm An algorithm comprises any of the following structures: sequence decision Repetition An algorithm may also involve parallelism (are there some activities that can be done concurrently?)

March R McFadyen2 Activity Diagrams start end branch merge fork join guard transition swimlanes activity Symbols

March R McFadyen3 Activity Diagrams - sequential Activity 1Activity 2Activity 3 Activities 1, 2, 3 follow one another in sequence. Activity 3 cannot start until Activity 2 is done, etc.

March R McFadyen4 Example: instructions to make Zucchini Relish Combine vegetables with pickling salt and leave overnight Drain and rinse Combine remaining Ingredients with vegetables Boil 20 minutes Put in sterilized jars Process in Canner

March R McFadyen5 Activity Diagrams – conditional path / 2-way switch Activity 1 Activity 2 [condition 1] [condition 2] One of two paths is chosen Same symbol for decision as for merge

March R McFadyen6 Example: instructions to make Zucchini Relish Combine vegetables with pickling salt and leave overnight Drain and rinse Combine remaining Ingredients with vegetables Boil 20 minutes Go and purchase ingredients [ Missing some ingredients ] [ have all ingredients ] Process in CannerPut in sterilized jars

March R McFadyen7 if ( count > 0 ) average = sum / count; System.out.println (average); If example [ count > 0 ] [ count <= 0 ] Average  sum/count Print average

March R McFadyen8 if ( count > 0 ) average = sum / count; else average = 0.0; System.out.println (average); If-Else example [ count > 0 ] [ count <= 0 ] Average  sum/count Average  0 Print average

March R McFadyen9 if ( x > 0 ) if (y > 0) { z = sqrt (x) + sqrt (y); System.out.println(“z = “ + z); } else System.out.println( “*** can’t compute z”); Nested If-Else example [ x > 0 ] [ x <= 0 ] [ y > 0 ] [ y <= 0 ] Z  sqrt (x) + sqrt (y) Print Z Print cannot compute Z

March R McFadyen10 If-ElseIf example [ pH < 3 ] [ pH < 7 ] [ pH = 7 ] [ pH < 12 ] if (pH < 3) System.out.println( "Solution is very acidic.”); else if (pH < 7) System.out.println( "Solution is acidic.”); else if (pH == 7) System.out.println(”Solution is neutral."); else if (pH < 12) System.out.println( "Solution is alkaline.”); else System.out.println( "Solution is very alkaline.”); [ pH >= 3 ] [ pH >= 7 ] [ pH <> 7 ] [ pH >= 12 ] Print “alkaline” Print “neutral” Print “acidic” Print “very acidic” Print “very alkaline”

March R McFadyen11 Activity Diagrams – multiway switch Activity 1 Activity n One of two paths is chosen Same symbol for decision as for merge Activity 2 [condition2] [condition1] [condition n]

March R McFadyen12 Multiway switch example switch (watts) { case 40: price = 0.50; break; case 60: price = 0.69; break; case 75: price = 0.85; break; case 100: case 150: price = 1; break; default: price = 0; System.out.print (“No bulb ” +watts + “watts in stock”); } // end switch

March R McFadyen13 Price  0.50 [watts= 40 ] Price  0.69 Price  0.85 Price  1.00 Price  0.00 [watts= 60 ] [watts= 100 or 150 ] [ watts 40, 60, 100, 150 ] [watts= 75 ] Print No bulb message Multiway switch example

March R McFadyen14 Activity Diagrams – iteration / looping Processing before test [ exit] Processing after test [ do not exit ]

March R McFadyen15 Activity Diagrams – iteration / looping Processing before test [ exit] Processing after test [ do not exit ] Its not the way you draw it … it’s the way control flows that’s important

March R McFadyen16 example int next; // the next number int sum = 0;// the sum so far int count = 0;// initialize loop counter while (count < MAX) {// test loop counter readInt(next); // get next number sum = sum + next;// add next number to sum count = count + 1; // increment loop counter } // end loop

March R McFadyen17 example Increment count [ Count < Max ] Read next integer Add integer to sum Sum  0 Count  0 [ Count = Max ]

March R McFadyen18 example count = count + 1;readInt(next);sum = sum + next; Sum  0 Count  0 If we wish, we could put the exact code into the activities [ Count < Max ] [ Count = Max ]

March R McFadyen19 Activity Diagrams – parallelism/concurrency Activity 1 Both paths are performed in parallel. Activity 1 and 2 begin when Activity 0 is finished. Activity 0 Activity 4 Activity 4 begins when Activity 1 and 3 have both completed Activity 2 Activity 3

March R McFadyen20 Example: instructions to make Zucchini Relish Combine vegetables with pickling salt and leave overnight Drain and rinse Combine remaining Ingredients with vegetables Boil 20 minutes Chop onionsChop ZucchiniChop green peppersChop red peppers Process in CannerPut in sterilized jars

March R McFadyen21 Zucchini Relish 12 cups chopped Zucchini 4 large onions, chopped 2 red peppers, chopped 2 green peppers, chopped 1/3 cup pickling salt 3 cups white vinegar 4 cups white sugar 3 tbsp. Cornstarch 2 tsp. Celery seed 2 tsp. Mustard seed 2 tsp. Turmeric

March R McFadyen22 Updating a Star Schema Churn Star Schema from The Official Guide to Informix/Red Brick Data Warehousing Rate_plan Period Customer Churn_reason Carrier Telephone Churn credit_limit outstanding_balance current_bill A Star Schema is a specialized ERD used in Data Warehousing. To update the database, we: (1) update each Dimension, and then (2) update the Fact table

March R McFadyen23 Updating a Star Schema Update Customer Update Churn Update Rate plan Update Churn Reason Update Telephone Update Carrier Update Period

March R McFadyen24 Updating a Star Schema Update Customer Update Churn Update Rate plan Update Churn Reason Update Telephone Update Carrier Update Period The dimensions can be updated independently of one another. Those activities can be carried on concurrently

March R McFadyen25 Activity Diagrams Activity 1 Activity 2 Activity 3 Swimlanes When we assign activities to particular organizational units, then we can partition the flow into swimlanes, one swimlane per unit. Activity 0 Activity 4 Org 1Org 2Org 3Org 4

March R McFadyen26 Activity Diagrams Workflow for an Order Request product Customer SalesWarehouse A customer requests a product. The order is handled by Sales, and then the Warehouse picks the materials and ships the order. Then, the customer will receive the order and Sales will send out the bill. When the customer receives the bill, it is paid, and the order is closed by Sales. Process Order Pick & Ship Receive Order Send Bill Pay Bill Order Closed Receive Bill

March R McFadyen27 Exercise for Express the Process Sale use case as an activity diagram with sequential activities at a high level of abstraction without any iteration. 2.Express the Process Sale use case as an activity diagram where iteration is illustrated in detail (for enterItem) 3.Use Swimlanes for each of the above