Page 213 - DCAP305_PRINCIPLES_OF_SOFTWARE_ENGINEERING
P. 213

Unit 10: Coding Standards



            Problem 2                                                                             Notes
            Turn on a light bulb
            Sub-problem 1: locate bulb (one task, one action)

            Sub-problem 2: depress switch






            Given a list of students’ test scores, find the highest and lowest score and the average score.
            Sub-problem 1: read students’ scores
            Sub-problem 2: find highest score
            Sub-problem 3: find lowest score


            Sub-problem 1 can be considered as one action and therefore wants no further refinement. Sub
            problems 2 and 3 however can be further divided into a group of actions. This is left as an
            exercise for the student.
            Advantages of the Top-Down Design Method
               •  It is easier to comprehend the solution of a smaller and less complicated problem than to
                 grasp the solution of a large and complex problem.
               •  It is easier to test segments of solutions, rather than the entire solution at once. This method
                 allows one to test the solution of each sub-problem separately until the entire solution has
                 been tested.
               •  It is often possible to simplify the logical steps of each sub-problem, so that when taken
                 as a whole, the entire solution has less complex logic and hence easier to develop.

               •  A simplified solution takes less time to develop and will be more readable.
               •  The program will be easier to maintain.
                          A partial formalization of the concept of algorithm began with attempts to
                          solve  the  Entscheidungsproblem  (the  “decision  problem”)  posed  by  David
                          Hilbert in 1928.

            Self Assessment Questions
               1.  ................. errors are very difficult to find as they do not manifest easily.

                 (a)  Software                   (b)  Synchronization
                 (c)  String handling            (d)  Warning
               2.  An  .......................is  a  sequence  of  precise  instructions  for  solving  a  problem  in  a  finite
                 amount of time.
                 (a)  syntax                     (b)  program
                 (c)  algorithm                  (d)  none of these

               3.  Advantages of the top-down design method:
                 (a)  The program will be easier to maintain
                 (b)  It must be precise and unambiguous



                                             LOVELY PROFESSIONAL UNIVERSITY                                   207
   208   209   210   211   212   213   214   215   216   217   218