Tutorial 7 Logic Requirements (Textbook Chapter 8 & Appendix) Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 1 Learning Objectives Practice Logic Modelling - Structured English and decision tables to representing steps in logical processes in DFDs and choice in conditional statements Practice Sequence Diagrams Practice Activity Diagrams Understand how logic modeling techniques apply to the development of electronic commerce applications. Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 2 Part 1: Decision Logic Ch. 8, Ex. 1: Represent the decision logic below in Structured English Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 3 Ch. 8, Ex. 1 (cont.): Possible solution: BEGIN IF IF Employee-Type is Salary THEN PAY base salary END IF BEGIN IF IF Employee-Type is Hourly AND Hours-Worked is <40 THEN CALCULATE hourly wage AND PRODUCE Absence Report END IF BEGIN IF IF Employee-Type is Hourly AND Hours-Worked is 40 THEN CALCULATE hourly wage END IF BEGIN IF IF Employee-Type is Hourly AND Hours-Worked is >40 THEN CALCULATE hourly wage AND CALCULATE overtime END IF Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 4 Ch. 8, Ex. 2 (part): Generate Structured English and Decision table logic modelling for some processes described in the DFD below Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 5 Ch. 8, Ex. 2 (cont.): Decision table for process 4.0: Conditions/Courses of Action Due Status Generate Rush Payment Generate Payment Postpone Payment 1 L Rules 2 D 3 N X X X Due status: L = Late; Date of invoice is more than 30 days before today's date. D = Due; Date of invoice is 30 days before today's date. N = Not due: Date of invoice is less than 30 days before today's date. Structured English representation for process 5.0: DO ACCEPT Inventory-record-id READ Inventory-record for Inventory-record-id PRINT Quantity-in-stock and Inventory-item-name UNTIL End-of-file Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 6 Ch. 8, Ex. 3: What types of questions need to be asked during reqs. determination to gather the logic modelling information? Start with the processes represented in the DFDs. Elicit information from users that will help model the logic within these processes and the events that initiate each process. Determine the process decision and temporal logic involved in the users' business processes. Ask the users to literally describe what happens in each of the processes on the data flow diagrams. when does the process occur? what are the explicit steps? how and by whom are they performed? in what sequence and at what time are they performed? are there any conditions, constraints, or contingencies on any of these steps happening? If so, what are they and how do they happen? Observe Tutorial 7 the actual processes. Do they fit with what users describe?7 © 2008 Prentice Hall, Ovidiu Noran Ch. 8, Ex. 4: Use Structured English to represent the logic in the following narrative: In a company the rules for buying perosnal computers are such that if the purchase is over $15,000 it has to go out for bid and the Request for Proposals must be approved by the Purchasing Department. If the purchase is under $15,000, the personal computers can simply be bought from an approved vendor; however, the Purchase order must still be approved by the Purchasing department. If the purchase goes out for bid, there must be at least three proposals received for the bid. If not, the RFP must go out again. If still there are not enough proposals, the process can continue with the vendors that have submitted proposals. The winner of the bid must be on an approved list of vendors for the company and, in addition, must not have any violations against them for e.g. environmental matters. At this point, if the proposal is complete, the Purchasing Department can issue a Purchase Order. Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 8 Ch. 8, Ex. 4 (cont.): (Main) BEGIN IF IF Purchase-amount is greater than $15,000.00 THEN Purchasing–Department APPROVES RFP DO Bid Process ELSE Purchasing-Department APPROVES Purchase PURCHASE equipment END IF (Bid Process) SEND RFP BEGIN IF IF three Proposals received AND Winning-Vendor is APPROVED by Purchasing-Department AND no Violations THEN AWARD contract PURCHASE equipment ELSE DO Rebid Process END IF RETURN Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 9 Ch. 8, Ex. 4 (cont.) (Rebid Process) SEND RFP BEGIN IF IF Winning-Vendor is APPROVED by Purchasing-Department AND no Violations THEN AWARD contract PURCHASE equipment END IF ISSUE Purchase Order RETURN Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 10 Ch. 8, Ex. 6 Present the logic of business processes described in the previous exercise in a decision table. How do decision tables compare with Structured English for this example? Conditions/Courses of Action Purchase Amount Vendor Approved Rules 1 G Y 2 L Y 3 G N 4 L N Award Contract to X Winning Vendor Issue Purchase Order X X Purchase Equipment X X Award Contract to Other X Approved Vendor Find Another Approved X Vendor Purchase Amount: G = greater than $15,000.00, L = less than or equal to $15,000.00 Vendor Approved: Y = Yes; approved by Purchasing Department N = No; not approved by Purchasing Department Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 11 Ch. 8, Ex. 6 (cont.) How do decision tables compare with Structured English for this example? Several fairly complicated conditions are present hence the Structured English approach may be better. Several decision tables could be used as well. Again, the decision tables are good at reviewing / optimising the decision logic but not at determining conditions and actions or at transforming conditions and actions into sequence Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 12 Part 2: Seq. & Activity Diagrams Tutorial 7 The Hire Employee use case / scenario © 2008 Prentice Hall, Ovidiu Noran 13 Tutorial 7 Assume there is only one scenario within the use case. 1. On receipt of a job application, the applicant data is entered through the application entry window 2. The manager opens the app review window and reviews the application 3. If the initial review is negative, the manager discards the app and conveys the rejection decision to applicant 4. If initial review is positive, the manager sets up a date and time to interview the applicant. The manager also requests that the referees specified in the app provide recommendation letters 5. The manager interviews the candidate and enters the info the application file 6. When the recommendation letters come in, the manager is ready to make a decision. Based on the summary, a decision is made. If the decision is to reject, the application is discarded and the applicant is notified. The processing of the application comes to an end 7. If the decision is to hire the candidate, a potential employee file is created and all relevant info is entered into this file. The hiring decision is conveyed to applicant. 14 © 2008 Prentice Hall, Ovidiu Noran Sequence Diagram for Hire Employee Decision logic : Explicitly shown external actor Decision logic Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 15 Ch. 8 App, Ex. 4 Draw an activity diagram for the previous employee hiring process. Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 16 Human Resources Department Manager Enter applicant data Review application -ve +ve Ask for references Set up Interview Hold interview Produce Summary accept reject Create potential employee file Send outcome to applicant Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 17 Part 3 Case Study: Pine Valley Furniture (PVF) Manufactures high-quality wood furniture Distributes to retail stores within the U.S. Started in the early 1980s and expanded by 1984 doubling sales volume By 1990, Pine Valley Furniture had become a complex company, employing over 50 persons Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 18 PVF: Logic Modelling Pine Valley Furniture development methodology dictated that the logic within each unique processes be represented. Structured English was chosen for modelling the logic. Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 19 Tutorial 7 Level-0 data flow diagram for theNoran PVF WebStore © 2008 Prentice Hall, Ovidiu 20 PVF: Logic Modelling Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 21 E-commerce App: Logic Modelling Process 3 decomposition DFD for the PVF WebStore Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 22 E-commerce App: Logic Modelling Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 23 E-commerce App: Logic Modelling Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 24 Summary In this tutorial you practiced: Logic Modelling - Structured English and decision tables Sequence Diagrams Activity Diagrams Logic modelling techniques applied to the development of electronic commerce applications. Tutorial 7 © 2008 Prentice Hall, Ovidiu Noran 25