Page 200 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 200
Unit 9: Software Development
Notes
Using the above flow chart draw a flow chart for adding two numbers and
find the output if it is odd or even for different cases.
Two common ways of planning the solution to a problem are to draw a
flowchart and to write pseudocode, or possibly both. Essentially, a flowchart
is a pictorial representation of a step-by-step solution to a problem. It consists
of arrows representing the direction the program takes and boxes and other
symbols representing actions. It is a map of what your program is going to
do and how it is going to do it. The American National Standards Institute
(ANSI) has developed a standard set of flowchart symbols. Figure 1 shows
the symbols and how they might be used in a simple flowchart of a common
everyday act-preparing a letter for mailing.
Pseudocode is an English-like nonstandard language that lets you state
your solution with more precision than you can in plain English but with
less precision than is required when using a formal programming language.
Pseudocode permits you to focus on the program logic without having to
be concerned just yet about the precise syntax of a particular programming
language. However, pseudocode is not executable on the computer. We will
illustrate these later in this chapter, when we focus on language examples.
9.3.1.3 Coding the Program
As the programmer, your next step is to code the program-that is, to express your solution in a
programming language. You will translate the logic from the flowchart or pseudocode-or some
other tool-to a programming language. As we have already noted, a programming language is a
set of rules that provides a way of instructing the computer what operations to perform. There are
many programming languages: BASIC, COBOL, Pascal, FORTRAN, and C are some examples.
You may find yourself working with one or more of these. We will discuss the different types of
languages in detail later in this chapter.
Although programming languages operate grammatically, somewhat like the English language,
they are much more precise. To get your program to work, you have to follow exactly the rules-
the syntax-of the language you are using. Of course, using the language correctly is no guarantee
that your program will work, any more than speaking grammatically correct English means you
know what you are talking about. The point is that correct use of the language is the required first
step. Then your coded program must be keyed, probably using a terminal or personal computer,
in a form the computer can understand.
One more note here: Programmers usually use a text editor, which is somewhat like a word
processing program, to create a file that contains the program. However, as a beginner, you will
probably want to write your program code on paper first.
9.3.1.4 Testing the Program
Some experts insist that a well-designed program can be written correctly the first time. In fact,
they assert that there are mathematical ways to prove that a program is correct. However, the
imperfections of the world are still with us, so most programmers get used to the idea that their
newly written programs probably have a few errors. This is a bit discouraging at first, since
programmers tend to be precise, careful, detail-oriented people who take pride in their work.
Still, there are many opportunities to introduce mistakes into programs, and you, just as those
who have gone before you, will probably find several of them.
LOVELY PROFESSIONAL UNIVERSITY 193