Software engineering for realtime systems Section 5 Program Slides: 10 Download presentation Software engineering for real-time systems Section 5 Program design concepts SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) Program design concepts - slide 1 Introduction Objectives To: · Show why quality programs must be well-structured. · Explain how structured programming can help to attain quality. · Describe the fundamental structures of structured programming. SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 2 Simple transformation actions SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 3 Complex transformation action SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 4 Basic control structures of structured programming SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 5 Equivalence of iteration structures SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 6 Composition of a structured program SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 7 Well controlled use of the GOTO statement Corresponding flow diagram Program fragment IF _ _? _ _ THEN GOTO High. Temp ELSE GOTO Continue; High. Temp : Statement 1; Statement 2; Statement 3; Continue : True ? False High. Temp S 1 S 2 S 3 Statement 4; Statement 5; Continue S 4 S 5 SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 8 Poorly controlled GOTO statements Corresponding flow diagram Start. Test S 1 Program fragment Entrypoint S 2 Start. Test : Statement 1 Entrypoint : Statement 2 If _ _ ? _ _Then goto Start. Test ; Statement 3 If_ _ ? _ _Then goto Entrypoint Statement 4 T ? F S 3 T ? F S 4 SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 9 Review of ‘Program design concepts’ SOFTWARE ENGINEERING for REAL-TIME SYSTEMS (© J. E. Cooling 2003) 10