Sie sind auf Seite 1von 17

Solving a problem on a computer involves the following activities:

1. Define the problem 2. Analyze the problem. 3. Develop an algorithm (a method) for solving
the problem. 4. Write the computer program corresponding to the algorithm. 5. Test and debug the program. 6. Document the program. (explanation of how the program works and how to use it.)

Algorithm Design

1.An algorithm is a set of instructions, which, if


accurately followed, will produce a solution to a given problem. When an instruction is followed, we say it is executed.

2.There are many different methods used for


writing algorithms.

3.Examples of algorithms are: flowcharts,


pseudocode, design structures, top down design approach, bottom up design approach,

Computer instructions fall into three main categories

1.Input instructions, used for supplying data to a


program inside the computer.

1.Processing instructions, used for manipulating


data inside the computer. These instructions allow us to +,-,X , , compare two values, and act according to the result of the comparison. Also, we can move data from one part of the memory to another. (assign)

1.Output instructions, used for getting

Categories of Programming

A program is a sequence of instructions to the


computer

The instructions are written in programming


language

Programmers write instructions in various


programming languages, some directly understandable by the computer and others that require intermediate translation steps.

Categories of Programming cont


Programming languages fall into the following categories:

1. 2. 3. 4. 5. 6.

Machine Language Assembly Language High Level Languages Fourth Generation Languages Fifth Generation Languages Natural Languages

Machine Language 1.consist of strings made up of 1s and 0s. The only programming language the computer can understand. (it is understood by the computer without any interpretation.)

2. All programs written in the other languages have to


be translated to machine languages before the computer can carry out the instructions. Advantages 1.Fast execution speed 2.Efficient use of main memory.

Assembly Language

is classified, as a low level language because


detailed knowledge of hardware specifics is still required. uses special code called mnemonic to represent machine language instructions. e.g., instead of using of 1s and 0s to represent an addition operation, a programmer might use the mnemonic AD.

before a computer can use an assembly


language, it must be translated into a machine language. This conversion is made with a language translator program called an assembler.

High Level Languages

closely resemble human language and


mathematical notations.

must be translated to machine language format. high level language is called the SOURCE
CODE while the translation version is called the OBJECT CODE.

Two types of translator programs are available


to translate the high level language code to

Compilers

1.translate the entire source code (all statement) to


its object code before execution takes place. A permanent object program is generated. Whenever changes are made to the source code the program has to be re-compiled for the changes to take effect.

Interpreters

2.translate high-level statements one at a time,


executing each step immediately after it has been translated. No permanent object program is

Advantages of High Level Language Over Machine Language

1.easier to learn and code programs in high level


languages since programmer does not need detailed knowledge of the computer or its internal operation

2.Errors are easier to avoid and detect 3.Many high level languages are machine
independent, making them portable

Fourth Generation Languages

requires much less effort in creating programs


that high level languages. The objectives include: increasing the speed of program development minimizing end-user effort to obtain information from a computer decreasing the skill level required of end users, so they can concentrate on an application rather than on the intricacies of coding. They can therefore solve their own problems without the aid of professional programmers. minimizing maintenance by reducing errors and

Fifth Generation Languages

(5GL) is one that provides a visual or


graphical interface for creating the source code (programming code).

often converts the source code to machine


language using a 3GL or a 4GL complier.

Object-oriented and web development tools


sometimes use a 5GL. For example visual basic

Natural Languages

making computer language as close to human


as possible.

E.g. a user enters the command Get me sales


figures for January 1992, a computer understanding natural languages could interpret this and supply the desired information.

They enable users to communicate with


computers in their native language (English,

PAST PAPER QUESTIONS

(1995) (9a) Define the following


Source code Object code Compiler

(9b) Draw a labeled diagram to illustrate the


relationship between source code, object code and compiler.

Past Paper Questions

1997 (9a) Explain the difference between high level


programming language and machine level language.

(9b) Explain the difference between an


interpreter and a compiler.

pseudocode

An imitation computer program written using


mathematical notations and English like statements to describe the logics to solve a problem or carry out a procedure.

GO BACK

mnemonic

A word or string which is intended to be easier


to remember than the thing it stands for. Most often used in "instruction mnemonic" which are so called because they are easier to remember than the binary patterns they stand for. characters also have mnemonics like NAK, ESC, DEL intended to evoke their meaning on certain systems.

GO BACK

Das könnte Ihnen auch gefallen