2023 Software
2023 Software
Programming Languages
In this chapter, you will learn about:
types of programming language, translators and IDEs
o advantages and disadvantages of high-level and low-level languages
o assembly language is a low-level language that uses mnemonics and assemblers
o the operation of compilers and interpreters for high-level languages
o advantages and disadvantages of compilers and interpreters
o the role and functions of integrated development environment (IDEs) when writing
code.
The very first computers (developed in forties) could not be programmed in today's sense.
Term software did not exist. Programmers manually set a number of jumpers (switches)
ON/OFF to perform a task.
Disadvantages
1. Programming in machine language was very hard and error-prone.
2. Programmers had to memorize that, E.g, 10001100 means "add", 11010101 means
"subtract" etc.
3. It is used to program a specific machine (machine dependent) and it works only in
that specific machine.
4. Difficult to check for errors in a program (debugging).
Assembly Level Language: Program language which uses mnemonic codes in which
each instruction corresponds to one machine code instruction. E g: Operating System,
Device Drivers, Games ect. ALL’s were developed to make programming easier. Obviously,
Page 1
COMPUTER SCIENCE (0478) Grade – 10
it is much easier to remember “ADD” rather than 10001100 denotes addition. The only
problem is that the computer doesn't have any idea what ADD means. That is why we
have to have a translator that translates mnemonic commands into binary codes. That
translator is just another program called “assembler”.
Here's a set of assembly language instructions with their meanings:
Instructio Meaning
n
LDA First LDA means load value of the variable (in this case, First) into the
accumulator
ADD ADD means add value of variable (in this case, Second) to the value
Second stored in the accumulator
STO Sum STO replace the value of the variable (in this case, Sum) by the value
stored in the accumulator
Fewer programmers write programs in an assembly language. Those programmers who
do, do so for the following reasons:
» to make use of special hardware
» to make use of special machine-dependent instructions
» to write code that doesn’t take up much space in primary memory
» to write code that performs a task very quickly
Advantages Disadvantages
Gain knowledge of how a computer Difficult to check for error in a program
works (debugging).
More control over how registers are Programmed for a specific machine (machine
accessed dependent)
Can access registers directly
Can write code that runs very fast takes a longer time to write a programs
Can write code that occupies less programs are difficult to understand
memory
High Level Languages: Programming language where instructions are very similar to
English. It is independent of computer hardware. Programs written in a HLL needs to be
translated into machine code before it is executed. E g: VISUAL BASIC, PYTHON, C++,
JAVA.
Each language has a unique set of keywords (words that it understands) and a special
syntax for organizing program instructions.
Advantages Disadvantages
Easy for the programmer to read/write as it is similar programs can take longer to
to English. execute
Easy to check for error in a program (debugging).
Programs can run on any machines (machine programs can be larger
independent). Occupies large memory
No need to understand registers/computer
architecture
Can write a program in a short period of time programs may not be able
Easy to maintain once in use. make use of special hardware
Translation Programs
“These programs are part of the systems software and are used to convert a
program from one language to other”.E g: Assembler, Compiler, Interpreter
Assembler: “Program that converts assembly language into machine code”.
Page 2
COMPUTER SCIENCE (0478) Grade – 10
Interpreter: “Program which runs high level language statement by statement”.
Compiler: “Program which converts the whole of high level language into
machine code in one go”.
Compiler Interpreter Assembler
Converts a high-level Runs a high-level language Translates a low level
language program into program one statement at a assembly language
machine code. time program into machine
code.
An executable file of No executable file of An executable file of
machine code is produced. machine code is produced. machine code is produced.
One high-level language One high-level language One low-level language
statement can be program statement may statement is usually
translated into several require several machine translated into one
machine code instructions. code instructions to be machine code instruction.
executed.
Compiled programs are Interpreted programs Assembled programs are
run without the compiler. cannot be run without the used without the
interpreter assembler
A compiled program is An interpreter is often used An assembled program is
usually distributed for when a program is being usually distributed for
general use. developed. general use.
Page 3
COMPUTER SCIENCE (0478) Grade – 10
certain point in the source code. A report window then shows the contents of the
variables and expressions evaluated at that point in the program. This allows the
programmer to see if there are any logic errors in the program and check that the
program works as intended.
error diagnostics & auto-correction. Dynamic error checking finds possible errors as the
program code is being typed, alerts the programmer at the time and provides a
suggested correction. Many errors can therefore be found and corrected during program
writing and editing before the program is run.
auto-completion. Code editors can offer context-sensitive prompts with text completion
for variable names and reserved words.
an auto-documenter and prettyprinting. IDEs can provide an auto-documenter to explain
the function and purpose of programming code. Most code editors colour code the words
in the program and lay out the program in a meaningful way – this is called
prettyprinting.
Activity 1
1. Tick () the appropriate column in the following table to indicate whether the
statement about the translator is True or False.
Tru Fals
e e
An assembler translates a high-level language program.
It is more difficult to write a program in a low-level language.
Java is an assembly language.
It is quicker to develop a program using a high-level language.
You always need a compiler to run a compiled program.
A program that is interpreted takes a longer time to run than a compiled
program.
Low-level languages are machine dependent.
Activity 2
1. Suki is writing a program in a high-level language.
a. Describe three features of an IDE that she would find helpful.
b. Describe three differences between a compiler and an interpreter.
c.Explain why a programmer would choose to write a program in assembly language.
Page 4