Information Systems Analysis and Design CSC340 X Business Rules Business Rules Structured English Decision Tables Decision Trees 2003 John Mylopoulos Business Rules 1 Information Systems Analysis and Design CSC340 Business Rules I I Business rules are used to describe the properties of an application e g the fact that an employee cannot earn more than his or her manager or that every employee has a unique employee number A business rule can be An integrity constraint on the data of the application e g each employee earns less than her manager a derivation rule whereby information can be derived from other information e g the price of a train ticket in Canadian dollars is given by the distance to be travelled in kilometers multiplied by 0 2 multiplied by 1 5 for a first class ticket 2003 John Mylopoulos Business Rules 2 Page Information Systems Analysis and Design CSC340 Examples of Business Rules Constraints BR1 The manager of a department must belong to that department BR2 An employee cannot earn more than her manager BR3 A department of the Toronto office can only be managed by an employee who has 10yrs experience BR4 An employee can only participate in projects associated with her department Derivations BR5 The budget of a project is the sum of all salaries of participating employees multiplied by 3 2003 John Mylopoulos Business Rules 3 Information Systems Analysis and Design CSC340 Specifying Business Rules I How do we specify business rules We ll be looking at several alternative notations Natural Language use unrestricted natural language but such descriptions can be highly ambiguous Structured English use a subset of a natural language both syntactically and vocabulary wise to minimize ambiguities this has been used with some success Decision Tables use a table representation of alternative outcomes similar to truth tables Decision Trees use a tree representation of alternative outcomes We need representations that are are understandable understandable by by end end user user 2003 John Mylopoulos Business Rules 4 Page Information Systems Analysis and Design CSC340 Structured English Looks a lot like pseudocode For Foreach eachLOAN LOANACCOUNT ACCOUNTNUMBER NUMBERininthe theLOAN LOANACCOUNT ACCOUNTFILE FILE do the following steps do the following steps IfIfthe theAMOUNT AMOUNTPAST PASTDUE DUEisisgreater greaterthan than 0 00 0 00then then while there are LOAN ACCOUNT NUMBERS for the while there are LOAN ACCOUNT NUMBERS for theCUSTOMER CUSTOMER NAME NAMEdo dothe thefollowing following sum sumthe theOUTSTANDING OUTSTANDINGLOAN LOANBALANCES BALANCES sum the MINIMAL PAYMENTS sum the MINIMAL PAYMENTS sum sumthe thePAST PASTDUE DUEAMOUNTS AMOUNTS report reportthe theCUSTOMER CUSTOMERNAME NAME LOAN LOANACCOUNT ACCOUNTon onOVERDUE OVERDUE CUSTOMER CUSTOMER LOAN LOANANALYSIS ANALYSIS Takes some effort to to specify specify not not very veryreadable readable too close to an implementation implementation 2003 John Mylopoulos Business Rules 5 Information Systems Analysis and Design CSC340 Another Example do while there are more staff in the list calculate staff bonus store bonus amount begin case case bonus 250 add name to StarOfTheMonth list case bonus 25 print warning letter end case end do 2003 John Mylopoulos Business Rules 6 Page Information Systems Analysis and Design CSC340 Some Rules for Structured English Use only nouns and terms defined in the project dictionary Avoid compound sentences because they can be highly ambiguous Avoid undefined adjectives and adverbs such as good nice etc unless if clearly defined in the dictionary in terms of value ranges e g good 65 75 Avoid language that destroys the natural flow of control within the process i e goto s Use a limited set of flow constructs such as sequencing if then else while do etc 2003 John Mylopoulos Business Rules 7 Information Systems Analysis and Design CSC340 Decision Tables I I I If there are n parameters or conditions to a decision each of which can take k1 k2 kn values then make up a table with k1 k2 kn columns and as many rows as there are possible actions or outcomes For example If the plane is more than half full and the flight costs more than 350 per seat serve free cocktails cocktails unless it is a domestic flight flight Charge for cocktails in all domestic flights where cocktails are served i e those that are more than half full conditions Domestic half full 350 seat Y Y Y Y N N N N Y Y N N Y Y N N Y N Y N Y N Y N outcomes Serve cocktails X X Free cocktails 2003 John Mylopoulos X X Business Rules 8 Page Information Systems Analysis and Design CSC340 How to Construct Decision Tables 1 Identify all conditions and all outcomes 2 Create the decision table with one column for each possible combination of condition values and one row for every possible outcome 3 Fill in the table 4 Eliminate ambiguities uncover cases contradictions redundancy 2003 John Mylopoulos Business Rules 9 Information Systems Analysis and Design CSC340 Completion and Simplification of a Decision Table Completion includes additional additional external input Domestic half full 350 seat Y Y N N N Y N Y N Y N N Domestic half full 350 seat Y Y Y Y N N N N Y Y N N Y Y N N Y N Y N Y N Y N Serve cocktails X X X X X Free cocktails X X Charge cocktails X X X No cocktails X X X Simplification Free cocktails X Charge cocktails X X No cocktails X X 2003 John Mylopoulos Business Rules 10 Page Information Systems Analysis and Design CSC340 Going to a Place In town Short distance Good weather Can afford Walk Take TTC Take taxi Take train Fly Y Y Y X Y Y N Y Y Y N N Y N Y X X Y N N N Y N N Y N N N X X X X X 2003 John Mylopoulos Business Rules 11 Information Systems Analysis and Design CSC340 Another Example Is budget likely to be overspent Is overspent likely to be over 2 No action Write letter letter Set up meeting meeting 2003 John Mylopoulos N X Y N Y Y X X X Business Rules 12 Page Information Systems Analysis and Design CSC340 Decision Trees I Nodes of a decision tree represent partial outcomes successors of a node represent mutually exclusive alternatives leaves of a decision tree represent outcomes Getting Home Out of Town Trip Trip Short Trip In Town Trip Have Car Have Car Fly Have Car No Car Take Car Take Car Walk Take Car TTC Taxi 2003 John Mylopoulos Taxi Business Rules 13 Information Systems Analysis and Design CSC340 Decision Trees An Example Note This is a real example Air shipping charges are set depending on the weight of a parcel The basic
View Full Document
Unlocking...