Software Design and Development
Home > Software Design and Development > Core > Software Development Cycle > Translation methods
Translation methods
In the implementation phase of the
software development cycle, previously developed algorithms are converted to a
form that can be processed by a computer. The translation method being used
should be recognised, particularly in the case of code.
Syllabus outcomes
H1.1 explains the
interrelationship between hardware and software.
H1.2 differentiates between
various methods used to construct software solutions.
Students should learn about
the translation methods used in developing software solutions (Syllabus
document, p.42).
The following headings may help you
navigate:
Program language implementation
A computer has two primary
components:
- internal memory: used to
store programs and
data
- processor: a
collection of circuits that provides a set of machine instructions, such as
those for arithmetic operations, logic operations and data moving. This is the
machine language of the individual computer.
The software that provides the high-level
language interface to the computer can take several different forms:
compilers, interpreters and hybrid implementation
systems.
This software depends not only on the
computer’s machine language but also on the operating system, which
supplies higher-level instruction sets for resource management, input and output
file management, etc. The operating system and the language implementations are
layered over the machine language of a computer and can be described as creating
a virtual language interface.

Compilation and the translation process
Programs written in high-level languages
are translated into machine code, which is executed directly on the computer.
C++, COBOL and Visual Basic 6.0 are all languages that have
compilers. The translation process has several phases but all the source
code is translated into object code before the program is run:
- The lexical analyser
gathers the characters of the source code into lexical units
(identifiers, special words, operators and punctuation symbols) using the syntax
rules of the language. Comments are ignored. Each lexical unit is assigned a
code called a
token.
- The
syntax analyser takes the tokens and their lexical units and builds them
into hierarchies (called parse trees) which show the logic of the
program. The parsed tokens go to the type checker to detect data types
and to look for mismatched data types within operations and sends an error
message.
- The
intermediate code generator produces object code (machine code) and many
compilers then optimise code to increase execution
speed.
- The
linker builds calls to required system (or other) programs when they are
needed by the user code. The required programs are found and linked to
the user program.
- The
machine code and system code, together, forms the object file or
executable
file.
- The
execution of a machine code program on a von Neumann architecture computer
occurs in a process called the fetch-execute cycle, described by
the following pseudocode:
BEGIN fetch-execute
initialise the program counter
REPEAT
fetch the instruction pointed to by the program counter
increment the program counter to point to the next instruction
decode the instruction
execute the instruction
copy result to memory
UNTIL computer is shut down
END fetch-execute
The speed of the connection between the
computer’s memory and its processor usually determines the speed of the
computer, because instructions can usually be executed faster than they can be
moved to the processor for execution. This connection is called the von Neumann
bottleneck.
The advantages of compilers are that
compiled programs:
- run
faster
- are usually
smaller (due to optimisation of
code)
- are harder to
reverse engineer or change because the source code is hidden from
view.
The disadvantages of compilers are that:
- run-time errors are not
found until the whole program has been
compiled
- if the
program needs modifying, it must be re-tested and
re-compiled.

Interpretation
Programs can be interpreted with no
compilation at all. The interpreter program acts as a virtual machine whose
fetch-execute cycle translates high-level language program statements, line by
line, as they occur.
Interpretation has the advantage of
allowing easy implementation of source code level debugging operations because
errors are found at the time that particular line is translated and executed.
Visual Basic 6.0 code is interpreted when run from within the VB Design
environment.
The advantages of interpreters are that
interpreted programs allow:
- easy implementation of
source code level debugging operations because syntax errors are found at the
time that particular line is translated and executed. For example, Visual Basic
6.0 code is interpreted when run from within the VB Design
environment
- run-time
and logic errors become evident as they are found during testing and more easily
corrected
- the program
to add stubs, flags or variable output statements for debugging, which can be
easily removed when testing and modification is
complete.
The disadvantages of interpretation are
that:
- execution time is much
slower in complex language programs as statement decoding becomes the bottleneck
(especially in programs using loops where the code must be translated each time
the loop
executes)
- code is
more easily accessed for illegal use by other
programmers
- programs
are generally larger.
Interpretation is a difficult process on
programs written in a complicated language because the meaning of each
expression and statement must be determined directly from the source code at
run-time.

Incremental compilation
Incremental compilation is a hybrid
between interpretation and compilation where some frequently used sections of
the program are translated into machine code and stored. The program is then
translated using an interpreter until the compiled sections are reached. These
sections are executed from the object code in memory. This system is faster but
retains some of the advantages of interpretation.
Other hybrid systems exist which
translate high-level language programs to an intermediate language designed to
allow easy interpretation. Java is an example of a language that is
implemented in this way. Java is compiled into special machine-independent
modules of bytecode in the Java Virtual Machine so it can then be interpreted
across a range of operating platforms.

Activity
- Construct a flowchart that shows the translation
process. Compare your answer with the diagram in either of the textbooks listed
below.
- Create a table that clearly shows the
advantages and disadvantages of interpreted, compiled and hybrid translation
systems.
Bibliography
Fowler, A. (2000). Heinemann Software
Design and Development HSC Course. Heinemann, Port Melbourne,
Victoria.
Sebesta, R. (1993). Concepts of
programming languages 2nd ed. Benjamin/Cummings Publishing
Company, Redwood City, California.
This work was prepared by
Beverley Sampford
