This Item Was Submitted to Loughborough University As A
Total Page:16
File Type:pdf, Size:1020Kb
This item was submitted to Loughborough University as a Masters thesis by the author and is made available in the Institutional Repository (https://dspace.lboro.ac.uk/) under the following Creative Commons Licence conditions. For the full text of this licence, please go to: http://creativecommons.org/licenses/by-nc-nd/2.5/ .- LOUGHBOROUGH UNIVERSITY OF TECHNOLOGY t LIBRARY AUTHOR/FILING TITLE ~fIT)j-,-h _e __ _________________________ -;'-- ___ _ F --ACC-ES-SIO-NiCOPY--NO~------ ---- --- ---- --- -,----~ __QJ tJ_'i o_S J~! _________ -- ---- -_-- VOL. NO. CLASS MARK t- of\f\l (of' , ...... '( J \t •·-....0 0 ,/• THE DESIGN OF A FIRST COURSE IN PROGRAMMING by Michael P. Brady B.Sc., H.D.E. A Master's Thesis Submitted in partial fulfilment of the requirements for the award of M. Phil. of the Loughborough University of Teohnology MAY 1986 @ by Miohael P. Brady B.So., H.D.E 1986 Supervisor Professor A.C. Bajpai, Director of C.A.M.E.T. and Head of the 'Department of Engineering Mathematics, Loughborough University of Technology. Local Supervisor Dr ..John O'Donoghue, Head of Mathematics, Thornond College, Limerick, Ireland. The Design of a First Course in Programming Michael P. Brady =========================================== ---------------- THESIS ABSTRACT A course was designed to teach Top-Down programming to second level students who had no previous computer experience. The purposes of the course were a) to enable them to become computer literate and b) to develop their problem-solving ability. The course was designed to teach programming in a manner which was independent of any particular programming language or machine. This approach was prompted by dissatisfaction with traditional courses which generally concentrate on the syntax and semantics of a particular programming language, at the expense of developing important underlying concepts. Initially, a review of the history of programming languages was carried out to identify the essential elements of programming. This review found that there was general agreement about the fundamental importance of structure and that it was not necessary to use all of the control constructs contained in the available languages (BASIC, COMAL and PASCAL). Both a mini-language; containing just two control structures, and a diagrammatic representation (structure diagrams) of the mini-language were then designed. The chosen control structures were IF/THEN/ELIF/ELSE for selection and a WHILE loop for iteration. The students were trained to solve problems using the mini-language and structure diagrams and were supplied with translation rules to convert their solutions into COMAL. Translation rules were also drawn up for PASCAL and BASIC. The course was tested with girls aged 15 and 16 years in a Dublin secondary school. These trials showed that the method may be used successfully with students of this age . •• j j j j · -' j j j j j j j .---~-.--. .. ~. - .-. j j , - j j j j j j j j j The Design of a First Course in Programming Michael P. Brady ------------------------------------------- ================ KEYWORDS Top-Down Analysis Structured Programming Control Structures Mini-Language Structure Diagrams Problem-Solving Second Level Students ACKNOWLEDGMENTS --------------- I wish to express my gratitude to Professor A.C. Bajpai for providing me with this research opportunity and for his support. I also wish to thank my local supervisor, Dr. John O'Donoghue of Thomond College Limerick, for his practical advice and for his constant interest in the project. I wish to thank the staff of the Holy Faith Secondary School, The Coombe, Dublin for their co-operation. In particular I would like to thank Sister Aideen, who made the school's computer facilities available to me at all times. Mia Delaney. who provided much background information, and Christina Nult;,'. who offered many helpful suggestions 1n preparing the manuscript. I would especially like to thank Mari ta McGrath who helped teach the course and whc offered much constructive advice and support. Finally, I would like to thank my wife, Bridin, whose constant support and encouragement were invaluable. TABLE OF CONTENTS ------------------ CHAPTER 1 INTRODUCTION 1 CHAPTER 2 HISTORICAL BACKGROUND 10 2.1 I~r~uction 10 2.2 The 1950s 10 2.3 The 1960s 14 2.4 Structured Programming 15 2.5 Computers in Education 18 2.6 The Irish Situation 23 CHAPTER 3 EDUCATIONAL ROLE OF STRUCTURED PROGRAMMING 27 3.1 Introduction 27 3.2 Structured Programming 28 3.2.1 Problem Definition 29 3.2.2 Top-Down Desi~n 29 3.2.3 Control Structures 32 3.2.4 Coding Style 33 3.3 Structured Programming ln Education 34 CHAPTER 4 DESIGN OF A SUITABLE MINI-LANGUAGE 37 4.1 Languages for Beginners' Courses 37 4.2 The Need for a Mini-Language 39 4.3 Mini-Language Definition 41 4.3.1 Iterative Structures 41 4.3.2 Decision Structures 44 4.3.3 Other Statements and Structures 45 4.4 Diagrammatic Representation of Program Design 46 4.4.1 Flowcharts 46 4.4.2 Pseudocode 47 4.4.3 Structure Diagrams 48 4.5 Translation of Diagrams into Programming Languages 50 4.5.1 Translation of Sequential Statements 51 4.5.2 Translation of the Conditional Control Structure 53 4.5.3 Translation of the Iterative Control Struct'lre 56 4.6 Choice of Implementation Language 58 CHAPTER 5 REVIEW OF THE AVAILABLE TEXTBOOKS 61 5.1 Introduction 61 .5.2 Basic ~omputer Programming for Students [51] 62 5.2.1 Flowcharts 62 .5.2.2 Selection and Iteration 64 5.2.3 Advanced BASIC 70 5.3 Foundations in Computer Studies with COMAL [49] 71 5.3.1 Selection 71 5.3.2 Iteration 74 5.3.3 Structure Diagrams 78 5.4 Structured Programming With COMAL [·50] 79 5.4.1 Iteration 82 5.4.2 Selection 83 5.5 Beginning CO MAL [52] 84 5.6. The Design and Use of Structured Algorithms [7] 85 5.7 Conclusion 90 CHAPTER 6 PROJECT RATIONALE 91 6.1 School and Student Background 91 6.2 Aims of the Course 95 6.3 Outline of the Syllabus 96 6.4 The Fifth Year Course 98 6.4.1 Developing the Concept of a Computer System 98 6.4.2 Variables, Input, Assignment and Output 98 6.4.3 Struct.ure Diagrams 100 6.4.4 The Conditional Control Structure 101 6.4.5 The Iterative Control Structure 102 6.4.6 Procedures 103 6.5 The Sixth Year Course 104 6.5.1 Arrays 105 6.6 Conclusion 106 CHAPTER 7 IMPLEMENTATION OF THE COURSE 107 7.1 Developing the Concept of a Computer System 107 7.2 The Concept of a Variable 110 7.3 The Assignment Statement 110 7.4 Input and Output Statements 112 7.5 Structure Diagrams 113 7.6 Top-Down Method 116 7.7 The Conditional Control Structure 119 7.7. 1 Rules for Translation of IF Statements into COMAL 120 7.7.2 Boolean Operators 121 7.8 The Iterative Control Structure 125 7.8. 1 Rules f9r Translation of Iterative Structure into COMAL 125 7.8.2 Fixed Iteration vs. Indefinite Iteration 127 7.8.3 General Method for Constructing Loops 130 7.8.4 Loops to Add Numbers 130 7.8.5 Problems Involving READ/DATA Statements 133 7.8.6 More Difficult Looping Problems 136 7.9 Procedures 138 7.9.1 Coding Style 141 7.9.2 Library Procedures 143 7.10 General Approach to Lllr~e Problems 145 7. 11 The Sixth Year Course 151 7.11.1 Introduction to Arl'IlYs 151 7.11.2 String Handling Functions 155 7.11.3 Arrays of Strings 157 7.11. 4 Sorting -Arrays 161 CHAPTER 8 EVALUATION OF THE COURSE 165 8.1 Introduction 165 8.2 The Metanic COMAL System 165 8.3 The Concept of a Computer System 166 8.4 Variables 166 8.4.1 String Variables 167 8.5 The INPUT Statement 169 8.6 Types of Problems for Exercises 170 8.7 Structure Diagrams 170 8.8 The Conditional Control Structure 173 8.8.1 Use of an ELSE Branch in IF Statements 175 8.8.2 The Use of 'Explicit' Boolean Conditions 176 8.8.3 De Morgan' s Law 179 8.9 The Iterative Control Structure 181 8.10 Procedures 181 8.11 Arrays 182 8.12 Projects 185 8.13 The Use of Structure Diagrams in Mathematics 190 Chapter 9 CONCLUSIONS 198 APPENDIX A Programming Course Notes 205 APPENDIX B Some Demonstration Programs 219 APPENDIX C Student Projects 227 APPENDIX D Mathematics Course Notes 234 APPENDIX E How To Use The Accompanying Disk 237 REFERENCES 239 CHAPTER 1 --------- INTRODUCTION ------------ A recent survey of Irish schools [1] concluded that many of our school leavers are computer illiterate. This is clearly undesirable in a society which is increasingly influenced by information technology and in which the rate of technological innovation is so rapid. The need for familiarisation with the new technology as part of the curriculum is now generally recognised. The government has expressed the hope that encouragement will be given to the promotion of the study of computers as part of the school curriculum [2] and has begun this process by including Computer Studies modules in both the Intermediate and Leaving Certificate programmes and by arranging for the supply of computing equipment to all second level schools. This view, that education should embrace the new technologies, has been endorsed by the recently formed Curripulum and Examinations Board [3] and by many other bodies representing teachers at all levels of education. The broad goal of all computer education is to provide students with an understanding of the operation and applications of computers and to alert them to the limitations and difficulties associated with the new technology.