Download presentation
Presentation is loading. Please wait.
1
March 200391.3913 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?)
2
March 200391.3913 R McFadyen2 Activity Diagrams start end branch merge fork join guard transition swimlanes activity Symbols
3
March 200391.3913 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.
4
March 200391.3913 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
5
March 200391.3913 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
6
March 200391.3913 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 Put in sterilized jars Go and purchase ingredients [ Missing some ingredients ] [ have all ingredients ]
7
March 200391.3913 R McFadyen7 if ( count > 0 ) average = sum / count; System.out.println (average); example [ count > 0 ] [ count <= 0 ] Average sum/count Print average
8
March 200391.3913 R McFadyen8 if ( count > 0 ) average = sum / count; else average = 0.0; System.out.println (average); example [ count > 0 ] [ count <= 0 ] Average sum/count Average 0 Print average
9
March 200391.3913 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”); example [ x > 0 ] [ x <= 0 ] [ y > 0 ] [ y <= 0 ] Z sqrt (x) + sqrt (y) Print Z Print cannot compute Z
10
March 200391.3913 R McFadyen10 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”
11
March 200391.3913 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]
12
March 200391.3913 R McFadyen12 Example – multiway switch 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
13
March 200391.3913 R McFadyen13 Example – multiway switch 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
14
March 200391.3913 R McFadyen14 Activity Diagrams – iteration / looping Processing before test [ exit condition ] Processing after test [ continue condition ]
15
March 200391.3913 R McFadyen15 Activity Diagrams – iteration / looping Processing before test [ exit condition ] Processing after test [ continue condition ] Its not the way you draw it … it’s the way control flows that’s important
16
March 200391.3913 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
17
March 200391.3913 R McFadyen17 example Increment count [ Count < Max ] Read next integer Add integer to sum Sum 0 Count 0
18
March 200391.3913 R McFadyen18 example count = count + 1; [ Count < Max ] readInt(next);sum = sum + next; Sum 0 Count 0 If we wish, we could put the exact code into the activities
19
March 200391.3913 R McFadyen19 Activity Diagrams – parallelism/concurrency Activity 1 Activity 2 Activity 3 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
20
March 200391.3913 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 minutesPut in sterilized jars Chop onionsChop ZucchiniChop green peppersChop red peppers
21
March 200391.3913 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
22
March 200391.3913 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
23
March 200391.3913 R McFadyen23 Updating a Star Schema Update Customer Update Churn Update Rate plan Update Churn Reason Update Telephone Update Carrier Update Period
24
March 200391.3913 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
25
March 200391.3913 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
26
March 200391.3913 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.