California State University, Northridge Effects Of
Total Page:16
File Type:pdf, Size:1020Kb
CALIFORNIA STATE UNIVERSITY, NORTHRIDGE EFFECTS OF ALGORITHM DESIGN ON PROGRAM DEVELOPMENT AND MODIFICATION A project submitted in partial satisfaction of the requirements for the degree of Master of Sciences in Computer Science by Marc K. Thompson January, 1983 The Project of Marc K. Thompson is approved: Jack/Alanen v G. , ichael Barnes, Chairman California State University, Northridge ii TABLE OF CONTENTS Page LIST OF TABLES • • • • • • • . v LIST OF FIGURES AND PROGRAMS • • • . vi Section 1. INTRODUCTION . 1 The Software Life Cycle •. 3 Elements of a Good Design 7 Research on Algorithm Design and Program Development • • • • • • • . 8 A Hierarchy of Programming Errors • . 13 Methodology issues for Experimental Software Engineering •••••• . 15 2. THE EXPERIMENT . 18 Statement of the Research Question . 18 General Hypothesis . 20 Method . 21 Subjects . 21 Course and Apparatus . 22 Program Tasks • . 24 Design . 26 Sampling Bias • . 31 Results for the Statistic Program • . 32 Results for the Encryption Program 36 Conclusion about Algorithms and Errors 41 Experimental control and the Experiment Investigation of Programming • • • • • 46 Future Research • • • • • • • • • • • • • 47 iii Section Page Generalized Summary • • • • • • • • • . 48 3. AN EXPERIMENTAL PROGRAMMING INTERFACE • • • 51 Procedure Routines . 55 Programs . 58 Conclusions • . 65 REFERENCES . 66 iv LIST OF TABLES Table Page I. Survey of the Languages . • • . 68 II. Survey of Average Number of Programs . 68 III. Means of Errors by Breakpoint Intervals . • . 69 IV. Means of Errors by Experimental Groups . • . 70 v. Correlation Matrix of the Three Types of Errors • • • • • • • • • . 71 VI. Means and Standard Deviations for Program Analysis • • • . 72 VII. Time Measures of the Three Graphs 73 VIII. Correlation Matrix for the Overall Analysis • 74 v LIST OF FIGURES AND PROGRAMS Figure Page 1. Example of Bubble Sort Algorithm ••••• . 75 2. Graph of Error Life Cycle: Syntax Errors . • 76 3. Graph of Error Life Cycle: Semantic Errors 77 4. Graph of Error Life Cycle: Logical Errors 78 5. Graph of Error Percentage: Program 1 • . 79 6. Graph of Error Percentage: Program 2 . • 80 7. Graph of Error Percentage: Program 3 . • . • 81 8. Graph of Error Percentage: Program 4 • . 82 Procedure Routine for Experimental Interface Page 1. XEDIT . 83 2. LIST . 83 3. RUN . 84 4. BYE . 86 Program for Experimental Interface Page 1. CALCUL • . 87 2. COMBIN • . 91 3. DATER . 91 4. TOTALS • . 92 5. CONVERT . 94 6. BREAK . 96 7. SEARCH • . 98 8. Plotting Program . • • • 104 vi ABSTRACT EFFECTS OF ALGORITHM DESIGN ON PROGRAM DEVELOPMENT AND MODIFICATION by Marc K. Thompson Master of Sciences in Computer Science A study of the effects of an algorithm on subsequent program development was conducted. More specifically, the general hypothesis was that if more time was devoted to algorithm design prior to coding, then less effort would be required during the testing stage. A three (algorithms) by five (intervals) MANOVA design was used to test the hypothesis. The independent variables were three styles of algorithm design (ALGORITHM-BEFORE, WITH-ALGORITHM, and NO-ALGORITHM) representing when an algorithm was specified and five vii task intervals representing each subject's programming effort. The dependent variables were the three types of errors (syntax, semantic, and logical) described by Young [1973] that were committed by the subjects in the testing stage. Two experiments, and a replication of both experiments, investigating program development and modification were conducted using 30 subjects. The subjects were divided into three groups, by algorithm design style. The experimental results supported the general hypothesis that if more effort was devoted to program design, prior to coding, then less effort was required in the testing stage. The results for both program development and modification generally supported the hypothesis that fewer logical errors would be committed with a fully-designed algorithm. The results for syntactic and semantic errors were inconclusive. In addition Young's [1973] intuitive notion of syntax errors precede semantic errors which in turn precede logical errors was supported. Lastly, a description of the experimental programming interface that was used to conduct these experiments. This interface was extended for future research on program development. viii INTRODUCTION This report is divided into three sections. The first section is an introduction to the research. The second section is a discussion of two experiments measuring the effects of algorithm design on program development and modification. The third section describes the software used to create an experimental programming interface. This interface was used for the collection and analysis of the data described in the experiments. The actual research project (section two) was divided into two different experimental tests. One test was the development of a new program and the second test was the modification of the program created in the first test. Two replications of these experimental tests were made. Thus there are four analyses of two original program development tasks (programs 1 and 3) and two modification of existing program tasks (programs 2 and 4). Program 2 was a modification of program 1, and program 4 modified program 3. The purpose of this research project was to study the effects of prior algorithm design on novice programmers's subsequent software development. This effect has become an important aspect to programmers. The overall design of a program is specified by the 1 2 algorithm created. The more specific the algorithm is with respect to the logic of the program's requirements, the better the algorithm should guide the programmer. This effect is similiar to an outline for a writer of a paper, in that the outline guides the flow of information to the reader and directs them to the goals of the paper. A secondary purpose was to create a software interface that could be used to gather data for experiments on program development. Certain specifications were required to make the experimental interface a naturalistic environment for observing the subject's programming efforts. These specifications were as follows: compatibility to the host environment, ability to perform operational system functions while recording programming efforts, and to facilitate data analysis. This special interface will be discussed later in section 3 since it is supportive to the following experiments but not central to the hypotheses investigated. Clearly, the effects of prior algorithm design on programming effort are dependent upon the skill of the programmer at using algorithms [Brooke and Duncan, 1980]. Novice programmers have limited experience in using algorithms. Because of that fact, it is important 3 to get some measurements on the initial efforts of novice programmers learning to design and implement algorithms in computer programs. Hopefully these measurements will be an aid in the teaching of problem solving with algorithms and programming. The diversity of people who are now using computer systems to do their work has increased the demand for better and more efficient teaching methods. Before presentation of the experiments, a brief discussion of the motivation for such research and a review of relevant literature is necessary. This introduction will focus on the software life cycle, past research efforts, and a hierarchical taxonomy of errors encountered in program development and modification. The Software Life Cycle In the creation of software, the programmer generally follows six stages of development. These stages are collectively called the software development life cycle. The six stages are requirements, specifications, design, coding, testing, and maintenance. The programmer starts with the requirement analysis stage followed by the specification stage. From the specifications, an algorithm is developed in 4 the design stage and this algorithm guides the coding stage. The requirements, the specifications, and the algorithm design direct the coding and testing stage. The users of the system dictate the final stage of operation and maintenance. Zelkowitz [1978] gave a rough estimate of the effort required by the various developmental stages. The requirement analysis and specification stages each take ten percent of the effort, design takes fifteen percent, coding takes twenty percent, testing takes twenty-five, and operation, excluding maintenance, takes twenty percent. If maintenance on a large scale system is included in the effort, it would take about two-thirds of the total effort. A widely held belief in software engineering is that more effort devoted to the requirements, specifications, and design stages will reduce the necessary effort in the coding, testing, and maintenance stages of the software life cycle. The significant stages of the software life cycle to this study are design, coding, testing, and maintenance. Usually, the requirements and specification are given to the novice programmer, so these stages will not be discussed. This is not to say that these stages are unimportant to programmers, but rather, they do not play a significant role in this 5 research. A brief discussion of the software life cycle as it pertains to the novice programmer is relevant to the understanding of the effects of an algorithm on software development. The design stage in the academic environment usually involves a flowchart or psuedo-code algorithm of some type. The algorithm is an abstract and