- •Unit 1. Computer Programming
- •Fortran
- •End user
- •Unit 2. Program Design
- •Steps in Computer Program Development
- •Evolutionary development concurrent activities
- •0A programmers
- •Unit 3. Programming Languages
- •Programming languages
- •Unit 4. Comparing Programming Languages
- •Comparing Programming Languages Technical factors
- •Political factors
- •Language vs Compiler for the Language
- •Tool Support and Documentation
- •Criteria for Comparing Programming Languages
- •Write in c
- •Unit 5. Structured Programming
- •Structured Programming
- •Algorithm Development and Pseudocode
- •Unit 6. Object Oriented Programming
- •Vocabulary
Unit 1. Computer Programming
Warm-up
Task 1. What do you know about programming? Answer the Internet Quiz.
When creating a computer program, the _____ designs the structure of the program.
end user
systems analyst
programmer
all of the above
none of the above
Checking a computer program for errors is called _____.
bugging
debugging
correcting
syntaxing
The computer itself uses _____ language.
natural
assembly
machine
high-level
none of the above
The language which is best for mathematical models is _____.
FORTRAN
BASIC
Java
C
COBOL
The term BASIC is an acronym for _____.
Balanced Assembly System Integrated Code
Basic All System Internal Code
Beginner's Assembly Syntax Instruction Code
Beginner's All-purpose Symbolic Instruction Code
A programming language which looks like normal English is a(n) _____ language.
normal
high-level
natural
4GL
7. The process of writing the computer instructions is called _____.
coding
compiling
debugging
interpreting
8. The most widely used language for business programs is _____.
Fortran
BASIC
Java
C
COBOL
9. The _____ must decide what a new program is to accomplish.
End user
systems analyst
programmer
supervisor
10. Documentation of computer programs is important so that _____.
users can learn how to use the program
other programmers can know how to maintain the program
the programmer can see why the code is written that way while hunting for sources of error
all of the above
a and b only
Listening
Task 2. Programmers sometimes use flowcharts when planning a program. Listen to the recording and identify these symbols used in flowcharts. Four symbols are not mentioned.
a) ________________ b) _________________ c) _______________
d) ________________ e) _________________ f) _______________
g) ________________ h) _________________ i) _______________
Task 3. Listen again to the recording and write below a typical example of an instruction often found there in flowcharts. One symbol has no words.
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
_____________________________________________________________________
Reading
Task 4. Look at the algorithmic flowchart on the next page and answer the questions.
Which computer commands does it show?
How many decisions does the computer make?
After the user clicks Save, how many times does the user input data?
How many ways of developing the events are possible here?
In what case will the program be completed in the shortest way?
Now describe this algorithmic flowchart.
The
program reads the file name, format and location.
YES
NO
Program
reads the file name, format and location.
YES
NO
|
Task 5. Read the text about computer programming. Write the number of the paragraph that gives you the information.
why high-level languages are easy to learn _____
a description of machine language _____
the greatest problem for computer programmers _____
the names of three high-level computer languages _____
a description of an algorithm _____
different uses of computers in our lives _____
a description of a computer program _____
what computers do with code _____
a description of the binary system _____
The diagram above shows part of a simple algorithmic flow chart for the Save command in a computer program. An algorithm is a set of logical rules that we use to solve a problem. Computer programmers often use algorithms to plan their programs, but the only language a computer understands without translation is machine language. This uses the binary system of 1 and 0, which matches the electrical positions ‘on’ and ‘off’. We can also show these numbers in English by Yes/No or True/False.
Machine language is a low-level language and is very difficult to write. Over the years, computer scientists have developed many high-level languages, such as BASIC, C++ and Java. These languages use a computer code that is similar to English, which makes them easier to learn. A computer program is just a set of coded instructions. A computer translates the code into machine language to complete a specific task. A computer receives input, processes data and produces results, or output, according to the program code.
We use computers in many parts of our lives, and not just in schools or for the Internet. There are computers in all kinds of electrical devices, from mobile phones to washing machines. We can find them in banks, supermarkets and cars. When programmers write programs, they have to plan carefully for every possible kind of error a computer user can input into the computer. It is planning for the random behaviour of humans that makes programming so much fun.
Speaking
Task. 6. Work in groups and discuss the following questions.
Have you ever had any problems with the computer?
What kind of errors do you make with computers?
How do you behave when things go wrong with a computer?
Listening
Task 7. Listen to the interview with Colin who is a programmer and answer these questions.
Is programming stressful?
What does Colin do as a break from programming?
Where do the team do much of the design work?
How many people are there in the team?
What do they do?
How long did Dante take to write?
Why was it easy to split?
What languages does he mention?
How does he keep up with developments in his field?
Why does he hate to go home sometimes?
Reading
Task 8. Work in groups of three: A, B and C. Read your text on the next page and complete the table.
|
Text A |
Text B |
Text C |
Type of error
|
|
|
|
Definition
|
|
|
|
Example
|
|
|
|
Ways to avoid or deal with this kind of error |
|
|
|
System errors affect the computer or its peripherals. For example, you might have written a program which needs access to a printer. If there is no printer present when you run the program the computer will produce a system error message. Sometimes a system error makes the computer stop working altogether and you will have to restart the computer. A sensible way of avoiding system errors is to write code to check that peripherals are present before any data is sent to it. Then the computer would warn you by a simple message on the screen, like ‘printer is not ready or available’.
Syntax errors are mistakes in the programming language (like typing PRNIT instead of PRINT). Syntax errors cause the program to fail. Some translator programs won’t accept any line that has syntax errors. Some only report a syntax error when they run the program. Some languages also contain special commands such as debug, which will report structural errors in a program. The programming manual for the particular language you’re using will give details of what each error message means.
Logic errors are much more difficult to detect than syntax errors. This is because a program containing logic errors will run, but it won’t work properly. For example, you might write a program to clear the screen and then print ‘hello’. Here is a code for this:
10// Message
20 PRINT ‘Hello’
30 CLS
40 END
The code has a logic error in it, but the syntax is right so it will run. You can get rid of logic errors from simple programs by ‘hand-testing’ them or doing a ‘dry run’ which means working through each line of the program on paper to make sure it does what you want it to do. You should do this long before you type in the code.
Task 9. Now share information orally about your text with others in your group to complete the table for each of the errors described.
Writing
Task 10. Draw a flowchart like one in Task 4 for one of these activities. Follow these steps:
Choose a simple procedure from the ones in the box below (or a simple one of your own).
Break the procedure down into all the steps that you have to follow. Think about where the process starts and ends, and the input from you and from the outside. When you make a decision, think of when you say ‘yes’ and when you say ‘no’, and what happens next.
Write exactly what happens at each stage.
Draw the flowchart, putting your text into the different shapes in Task 2.
Show your flowchart to another student. Does he/she agree with your steps?
Making a cup of tea or coffee Making a telephone call Sending a text message Answering the door |
Planning a holiday Choosing a new computer Preparing for an important exam Playing a cassette or a CD |
Speaking
Task 11. Read the quotations about ‘programming’ below. Discuss with other students what point you think each quotation is trying to make and whether you agree with it.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. (Rich Cook)
To understand a program you must become both the machine and the program. (Alan J. Perlis)
Perhaps if we wrote programs from childhood on, as adults we'd be able to read them. (Alan J. Perlis)
Programming is like sex, one mistake and you have to support it for the rest of your life. (Michael Sinz)
“There are two ways to write error-free programs; only the third one works.” (Alan J. Perlis)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher’s law of software engineering)
It is easier to change the specification to fit the program than vice versa. (Unknown)
Most people find the concept of programming obvious, but the doing impossible. (Alan J. Perlis)
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. (Elbert Hubbard)
Those parts of the system that you can hit with a hammer are called hardware; those program instructions that you can only curse at are called software. (Anonymous)
Any given program costs more, and takes longer. (Computer law)
The most harmful error of any program will not be discovered until the program has been in production for at least six months. (Troutman's programming postulates)
Profanity is the one language that all programmers know the syntax of. (Troutman's programming postulates)
Real programmers never work from 9 to 5. If any real programmer is around at 9 a.m., it’s because they were up all night. (Some computer geek)