Chapter 05

Chapter 05 - Chapter 5 Top-down Design and Branching...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 5 Top-down Design and Branching Statements This chapter introduces a systematic method for designing programs called “top-down design”, and it also introduces a new class of programming statements, called “branching” statements. The two are related because branching statements are often used in the design method. We begin by considering the design method. It is one of many methods developed by the researchers in program design who deal with large and complex problems. Their discipline is called Software Engineering. 5.1 Software Engineering Matlab programs are written to solve problems. The problems may be so simple as to require only a few lines of code, or so complicated that dozens of pages of code are involved. The simple ones can often be written intuitively with little planning. The complicated ones require considerably more skill. Learning how to get started, what to do next, and how to reduce the number of errors in the code all become more important as the problems get more complex. To a certain extent, anyone who wants to become skilled in solving problems by writing programs must learn by practice. However, there are some techniques that have been developed by experienced programmers that can make the typical novice programmer more efficient more quickly. These techniques become more important as the problems get more complicated and as the programs that solve them get larger. This chapter deals with one of those methods. Simple problems that require programs of no more than fifty to one hundred lines of code or so can solved by one person in one sitting. They are typically used only once, or a few times, to find the answer to a small set of problems. An example is the problem of calculating a course grade from the scores on graded assignments and the weights of these scores. Complex problems, on the other hand, may require programs of thousands, tens of thousands, or even hundreds of thousands of lines of code. Writing such large programs typically requires more than one person and involves months or years of work, and they are typically used many times by people who often know little or nothing about programming. An example is a game-playing program or a spreadsheet designed for calculating taxes. The solution of such complex problems is so difficult that an entire discipline has arisen to study them. That discipline is called Software Engineering . The goals of Software Engineering are to understand the source of the difficulties of solving large programming programs and to develop effective methods for writing good programs in the face of these difficulties in a predictable period of time. “Good” programs are those that not only have few errors, but also are easy to modify. Errors, also called “faults” or “bugs”, are frustrating for the user and also expensive and, in some cases, dangerous. Ease of modification reduces the effort necessary both to eliminate
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
errors when they are discovered and to add functionality when it is needed. Many studies
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course CS 103 taught by Professor Fitzpatrick during the Spring '07 term at Vanderbilt.

Page1 / 14

Chapter 05 - Chapter 5 Top-down Design and Branching...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online