1 / 40

Chapter 2.1

Chapter 2.1. Program Design and Documentation. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams

fredas
Download Presentation

Chapter 2.1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2.1 Program Design and Documentation

  2. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  3. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  4. What should the system/program do ? Formally: Set of all possible inputs {I} Set of all possible outputs {O} Function mapping all elements of {I} into elements of {O} Possible for simple and small programs Unfeasible for large scale systems System/Program specifications

  5. None Many Interactions with other programs Number of users Only the author 1 3 Many, 3 9 The effort of Specifying

  6. Specifications for large scale systems ? Make reasonable set of specifications REPEAT 2.1 Build prototype 2.2 Evaluate prototype 2.3 Update specifications UNTIL satisfaction of (potential) users Write down final specifications System/Program specifications

  7. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  8. The Cost of Softwarefor large systems During design and coding efforts should be made to reduce the cost of debugging and maintenance

  9. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  10. Top-down design: From global to detail Decompose the problem in simpler subproblems Further decompose subproblems UNTIL all subproblems have trivial solutions Bottom-up design: From detail to global Solve some small problems that might be useful for solving the big problem Use the partial solutions for assembling a global solution Design Methods

  11. Specifications : Given : A car with a flat tire Wanted : Instructions for fixing it Strategy choice : Wait with a smile until somebody fixes it … Call a repair service Try to repair yourself Example : Repairing a flat tire

  12. WHAT IS A PROGRAM ? PROGRAM = Description of data + Actions to perform upon these data

  13. “Data” Car, Defective wheel, Spare wheel, Tools. Actions All that need to be done with the Car, the Defective wheel, the Spare wheel and the Tools in order to solve the problem. Repairing a flat tire“Data”and Actions

  14. Inspect the spare wheel If available and in good condition, Then, repair yourself Else, you will need to call help Repairing a flat tireTop level design of actions

  15. Fetch the tools Fetch the spare wheel Exchange defective and spare wheels Store defective wheel Store tools Repairing a flat tireRefinement of “repair yourself”

  16. Tools : Jack : device to lift a car Wrench : device to loose or fasten bolts Repairing a flat tireRefinement of “tools”

  17. REPEAT loose one bolt with wrench UNTIL all bolts loose; Lift car with Jack; REPEAT remove one bolt UNTIL all bolts removed; Remove defective wheel; Put spare wheel in place; REPEAT replace one bolt UNTIL all bolts in place; Lower car with Jack; REPEAT fasten one bolt with wrench UNTIL all bolts fastened; Repairing a flat tireRefinement of “Exchange defective and spare wheels”

  18. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  19. Problem : If a data item is slightly changed, the entire program needs to be checked. Solution : Group data with description of all actions that can be performed upon such data Access data exclusively through the actions predefined for these data Object = data + actions to access it. Object oriented Design

  20. Instance of the object : MyJack Possible actions : Fetch Inspect Store Lift a car Lower a car Repairing a flat tireObject-oriented style Object Jack =

  21. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  22. Repairing a flat tireDecision Table OK Not OK Spare Wheel Tools Available & OK Repair yourself Get Help No good tools available Try to borrow tools Get Help

  23. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  24. Spare Wheel OK ? Get Help Repair yourself Repairing a flat tireTop-level Controlflowchart Yes No

  25. Get Tools Get Spare Wheel Change Wheel Store Bad Wheel Store Tools Repairing a flat tireRefinement of “repair yourself” Spare Wheel OK ? No Yes Get Help Repair yourself

  26. Repairing a flat tireRefinement of “Get Tools” Tools present & OK ? Yes No Try borrowing Tools Got Tools or Tired ? Pick up the Tools No Yes Tools present & OK ? Yes No Help Needed !!!

  27. Repairing a flat tireAdapted refinement of “Get Tools” Tools present & OK ? Yes No Try borrowing Tools Got Tools or Tired ? Pick up the Tools No Yes

  28. Repairing a flat tireImproved top-level design Spare Wheel OK ? No Yes Fetch Tools Tools OK ? No Yes Get Help Repair yourself

  29. Selection Statement selector = a ? Tasks to be done if selector = A Yes No selector = b ? Tasks to be done if selector = B Yes No selector = c ? Tasks to be done if selector = C Yes No Tasks to be done if no criteria OK

  30. Selection Statement selector selector selector # a selector # b selector # c selector = a selector = b selector = c Tasks to be done if selector = B Tasks to be done if selector = C Tasks to be done if no criteria OK Tasks to be done if selector = A

  31. Iteration Statement Initialization Loopbody, part 1 Termination Test Finish Continue Loopbody, part 2

  32. Iteration Statement Initialisation Loopbody Part 1 Termination Condition Loopbody Part 2

  33. Tools present & OK ? Yes No Get your own tools Try to borrow tools Spare Wheel ? OK Not OK Fetch Tools Until You got tools OR you are tired Tools ? OK Not OK Get Help Get Help Repair Yourself Get spare wheel Change wheel Store bad wheel Return tools Repairing a flat tire

  34. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  35. Data-flow Diagrams Bad Wheel Spare Wheel Tools FETCHED REMOVED MOUNTED STORED STORED

  36. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  37. Driving Successful help Done Puncture Flat tire Spare wheel OK No good Spare wheel Need help Good spare wheel No success No tools Try borrow tools Tools OK Success Repairing State DiagramsFlat tire problem

  38. State DiagramsElectronic lock Waiting 1st digit Spontaneous transition First digit entered Waiting 2nd digit Opening door Second digit entered Wrong Key Waiting 3rd digit Third digit entered Good Key Testing key

  39. System/Program specifications System/Program design Top-down & Bottom-up design Object Oriented design Tools for system/program documentation Decision tables Control-flow & Nassi-Shneiderman diagrams Data-flow diagrams State diagrams Unified Modeling Language Summary

  40. Tool for supporting / documenting object oriented designs Applicable to the Organizational level System level Program level Set of different diagrams, including Class diagrams (= objects and their static relations) Interaction diagrams Activity diagrams (= extended control flow diagrams) State diagrams Deployment diagrams Unified Modeling Language

More Related