Programming IGCSE
Programming IGCSE
8.2 Translators
In order to execute a program written in a high-level language, it needs to be
converted into machine code that the computer can understand. This is done
using translators. The main types of translators are compilers, interpreters,
and assemblers.
8.2.1 Compilers
A compiler translates the entire high-level program into machine code in one
go. The output is typically an executable file that can be run directly on the
computer.
Advantages of Compilers:
o Faster execution: Once compiled, the program runs faster
because it is already in machine code.
o No need for source code after compilation: The program can
be run without needing the original code or compiler.
Disadvantages of Compilers:
o Slower development cycle: Errors are identified only after
compiling, which can delay the debugging process.
o More memory usage: Compiled programs are often larger in size.
8.2.2 Interpreters
An interpreter translates high-level code line by line into machine code. It
executes the program directly, but each line of code is translated every time the
program is run.
Advantages of Interpreters:
o Faster development cycle: Errors are identified immediately,
allowing for quicker testing and debugging.
o No need for compilation: Programs do not need to be compiled
before running.
Disadvantages of Interpreters:
o Slower execution: Since the program is translated line by line, it
runs slower compared to compiled code.
o Requires the source code: The interpreter must have access to
the original code every time the program runs.
8.2.3 Assemblers
An assembler is a translator used to convert assembly language code into
machine code. Assembly language is a low-level programming language that
uses mnemonics instead of binary code.
Advantages of Assemblers:
o Control over hardware: Provides programmers with detailed
control over the system's resources.
o Optimized performance: Assembly language can be more
efficient and faster than high-level languages.
Disadvantages of Assemblers:
o Complex syntax: Writing in assembly requires detailed knowledge
of the hardware.
o Not portable: Assembly language code is specific to the processor
and hardware.
Disadvantages:
o Inflexible: Difficult to make changes once a phase is complete.
Advantages:
o Faster development: Frequent releases lead to quicker delivery of
working software.
o Adaptability: Can easily accommodate changes in requirements.
Disadvantages:
o Requires frequent communication: Successful Agile
development relies on constant interaction between developers and
clients.
o Can be difficult to manage: Without clear documentation, the
process can become chaotic.
8.3.3 Spiral Model
The Spiral Model combines elements of both the Waterfall and Agile
methodologies, focusing on iterative development with regular assessments and
refinements.
Phases of the Spiral Model:
1. Planning: Identifying goals and requirements.
2. Risk Analysis: Evaluating potential risks and issues.
3. Engineering and Design: Developing the software.
4. Evaluation: Reviewing the progress and making improvements.
5. Repeat: Iterating through the steps until completion.
Advantages:
o Risk management: Focuses on identifying and mitigating risks
early in the process.
o Flexibility and adaptability: Allows for changes at each iteration.
Disadvantages:
o Complex and expensive: Requires careful planning and
management, making it costlier.
o Not suitable for small projects: More suited to large, complex
projects.