Programming language
GOOD DAY, students. This is lesson 26 in our series of lessons. In this week’s lesson, we will be looking at programming languages (the beginning of a new unit).
Here is the solution to the practice questions you were provided with in the previous lesson.
QUESTION 1 QUESTION 2
(a) 17 DIV 8 = 2 (b) 17 MOD 8 = 1 (c) /
PROGRAMMING LANGUAGES
Programming languages fall into the following categories:
1. Machine language – Categorised as a 1stgeneration language.
2. Assembly language – Categorised as a 2nd-generation language.
3. High-level language – Categorised as a 3rd-generation language.
4. Fourth-generation language.
These languages can be further categorised as either being low-level or high-level languages.
LOW LEVEL
Machine language Assembly language
HIGH LEVEL
High-level language Fourth-generation language
Let us now examine each of these languages.
MACHINE LANGUAGE
This was the first language available for programming. At the machine level, the instructions are written in ones and zero (binary digits). This is the only language that the computer understands.
ADVANTAGES
Programs execute fast. Efficient use of memory.
DISADVANTAGES
Programming is slow and tedious. Code difficult to learn, read, understand and correct.
Code is machine-specific – that is, it cannot be used in the same form on other computer models.
ASSEMBLY LANGUAGE
This was developed to replace the zeros and ones of machine language with symbols that are easier to understand and remember. It uses special codes, called mnemonics (words that suggest meaning), to represent machine language instructions.
An assembly language is translated into a machine language by using a translator program called an assembler. However, both the machine language and assembly language programs are machine dependent, i.e., the way the program is written depends on the operation of the computer.
ADVANTAGES
Programming is faster and less tedious than for machine language.
Code is easier to learn, read and understand than for machine language. I Execution faster than high-level languages.
DISADVANTAGES
Programming is slower and more tedious than high-level languages. Code is machinespecific.
HIGH-LEVEL LANGUAGE
These differ from low-level languages in that they require less coding details and make programs easier to write. They are closer in appearance to natural language, for example, English and French. Programs written in highlevel language are called source code, while the translated version is called object code. These programs must be translated to a form which can be accepted by the computer. This is achieved by means of a special translator programs called compiler and interpreter.
In contrast to a compiler, an interpreter does not translate the whole program prior to execution. Rather, it translates the code, line by line, during the execution of the program. With the compiler, all the translation is done, and then the object program is executed. They are not machine-dependent. Examples of high-level language are: BASIC (Beginners All Purpose Symbolic Instruction Code), Pascal, COBOL (Common business oriented language), JAVA, C Programming, and so on.
ADVANTAGES
Programming is faster and less tedious. Code is easier to learn, read, understand and correct.
Language is more English and math-like.
DISADVANTAGES
Program executes slowly.
FOURTH GENERATION
They are often described as very high-level language and referred to as 4GLs. They are easy-to-learn, easy-to-use languages that enable users or programmers to code applications quicker than they could with lowerlevel languages. Two examples of 4GLs are DBASE and FOXPRO.
ADVANTAGE
Useful for generating reports.
DISADVANTAGE
Can be very wordy.
KEY PROGRAMMING TERMS
1. Algorithm – It’s a logical sequence of steps designed to solve a problem. An algorithm can be written in any suitable form, such as pseudocode, narrative, and represented graphically in a flow chart.
2. Pseudocode – This is an imitation of a computer program written using mathematical notations and English-like statements to describe the logic to solve a problem or carry out a procedure.
3. Test data – Data which is used to test a program for errors/special data created by a programmer to test the accuracy of the program.
4. Dry run – This is the process whereby a program is checked to ensure that it does what it was designed for. Test data would be used to test the program written to find the difference of two numbers.
5. Bug – A software bug may be defined as a coding error that causes an unexpected defect, fault, flaw or imperfection in a computer program.
6. Structured walkthrough – This is a manual trace of the logics of a program using test data.
7. Runtime errors – Run-time errors occur when a syntactically correct program statement cannot execute successfully. A common example is attempting to divide by zero (0).
8. Loading – This is the process of transferring program and data from secondary storage to primary storage.
9. Syntax errors –These are errors reported by the compiler/interpreter when the rules of the language are not obeyed. (An example of this
was shown for the explanation of a bug).
10. Logical errors – These errors occur when the expected results of a program are not met.
11. Testing – This is the process of checking a program for errors. This involves running and compiling the program, where a feedback will be provided by the translator.
12. Debugging – This is the process of testing, locating and correcting mistakes by running the program.
13. Linking – This is combining various pieces of code and data to form a single executable object code that can be loaded in memory. Linking can be done at compile time, at load time, and also at runtime.
14. Compiling – This is used for converting a program into a machine code or lower-level form in which the program can be executed.
15. Executing/run – This is the process by which a computer performs the instructions of a computer program.
16. Desk checking – Tracing involves executing the program manually by using values for variables and recording what takes place after each instruction is executed.
17. Program listing – This is a printout or soft copy of the source program instructions as a reference while working and coding the program.
We have come to the end of this lesson. See you next week when we will look at some key programing terms and the Pascal language. Remember, if you fail to prepare, you prepare to fail.