You are on page 1of 3

PROGRAMMING

A computer program is a set of instructions that tell a computer what to do and how to do it.
There is only one programming language that any computer can actually understand and
execute: its own binary machine code. The CPU interprets this code in order to carry out the
instructions of the program. There are many programming languages that are broken into two
categories: low-level languages and high-level languages.
Low Level languages - these languages are machine dependent i.e. the code written
can only be understood by the particular computer or processor that was used to write the code.

The first generation language, called machine language, uses the digits 0 or 1 that make up
the binary code. An instruction might be written as 10110000 01100001.
Advantages:
Able to be executed very fast by the computer, as there is no need for
translation.
Disadvantages:
Difficult to read, write and understand by humans as the programs involve
only 0s and 1s
Machine dependent, so unable to be used on another machine
Difficult to modify or correct mistakes
The second generation language called assembly language; instructions are written using
mnemonics or abbreviated forms of word. Example it uses words like ADD for addition and SUB
for subtraction. It needs an assembler to convert from assembly language to machine language.
Advantages:
Easier to read, write and understand than machine level languages
Easier to modify or correct mistakes than machine level languages
Disadvantages:
Slower in execution than machine-level languages
Still machine dependent
High Level Languages use keyword similar to English and are easier to write. Unlike
low level languages they are not machine dependent (programs written on one computer can
generally be used on another similar computer).

Third generation languages (3GLs) use statements in English that are easy for
programmers to use. These languages are converted to machine code, rather like
translating from one language to another, so that the computer can carry out the
instructions in the CPU. Examples are FORTRAN, BASIC, Pascal and C.
Advantages:
Easier to read, write and understand than low level languages
Easier to modify or correct mistakes than low level languages.
Machine independent
Disadvantages:
Slower in execution than low level languages because it has to be
converted.
Fourth generation languages (4GLs) are considered advanced high-level
languages. These languages also consist of English like instructions and are much
more user friendly than third generation languages. They offer extra help through
prompts and wizards. This reduces the time taken to write programs. It also
reduces the cost of software development. E.g. SQL (Structured Query Language),
Oracle, Visual Basic, C++, Oracle Report
An instruction would look like FIND ALL RECORDS WHERE NAME IS "SMITH"
Advantage:
useful for generating reports
Disadvantage:
can become very wordy
Fifth generation languages (5GLs) instructions are used in a conversational way
so it is also called natural language programming. They are sometimes called non-
procedural languages. Non-procedural languages only require the programmer to
write the goals that have to be achieved and not the sequence of steps to solve a
problem. The computer would solve the problem it works out the required steps.
E.g. of a command: GIVE ME THE TOTAL NUMBER OF ITEMS PURCHASED BY
CUSTOMERS FROM BARBADOS. 5GLs are used in artificial intelligence where
computers are given qualities of a human. Prolog and Mercury are fifth generation
languages.
Advantage: computers will be able to communicate in natural spoken
language with their users
Disadvantage: very complex to design, programmer must be highly trained.

Sequence of steps associated with implementing a program.


Step 1
o Source code - a program written in a given computer language. It is a computer
program in its original, human-readable form.
Step 2
o Compile translate from high level language into machine code that the
computer can understand
o Object code - the program, in machine code, that is the output of source code
being compiled.
Step 3
o Linking this is the process of combining together individual object code files to
form a single executable program (a program that is ready to run by a computer
system).
Step 4
o Executing - to run the program.
Step 5
o Maintain program is the process of making any modifications that may need
to be made to a developed program to make it suitable for a particular situation

Explain commonly used terms and concepts in programming

Testing - process used to verify that a program meets it's specify requirements and to detect
errors. You must first compile the program. You will find all syntax errors when you compile the
program. To test the logic of the program you must use appropriate test data which you know
the resulting answer(s) for before running it through the program.

Debugging - the finding and correcting of errors that exist in your program.

Logic errors is when the program does not produce the required results due to incorrect
logic. This error can not be detected by the compiler, it can be detected when the program is
run; using appropriate test data and the actual output doesn't match the required output. Logic
errors are usually the hardest to debug because they do not cause the program to fail
completely.

Syntax error -an error caused by incorrect use of a language violating the rules governing the
structure of it. These errors are found during compilation. It may be the misspelling of a word or
the opening of a command without closing it.

Run-time error occurs when the program has to terminate before its completion. Such as
division by 0.

Test data is values in a program to determine if it produces the required results. It is used to
the test a program for logic errors. When selecting test data to desk check an algorithm, you
must look at the program specification and choose simple test cases only.

Dry run - a manual walk through of the logic of a program using appropriate test data.

Interpreter converts a high-level program one line at a time and executes it was immediately

You might also like