
498
20 FURTHER PROGRAMMING
20 Further programming
In this chapter, you will learn about
+ the characteristics of a number of programming paradigms, including
low-level programming, imperative (procedural) programming,
object-oriented programming and declarative programming
+ how to write code to perform file-processing operations on serial,
sequential and random files
+ exceptions and the importance of exception handling.
20.1 Programming paradigms
WHAT YOU SHOULD ALREADY KNOW
In Chapter 4, Section 4.2, you learnt about
assembly language, and in Chapter 11, Section 11.3,
you learnt about structured programming. Review
these sections then try these three questions
before you read the first part of this chapter.
1 Describe four modes of addressing in
assembly language.
2 Write an assembly language program to add
the numbers 7 and 5 together and store the
result in the accumulator.
3 a) Explain the difference between a
procedure and a function.
b) Describe how to pass parameters.
c) Describe the difference between a
procedure definition and a procedure call.
4 Write a short program that uses a procedure.
Throughout this section, you will be prompted
to refer to previous chapters to review related
content.
Key terms
Programming paradigm – a set of programming
concepts.
Low-level programming – programming instructions
that use the computer’s basic instruction set.
Imperative programming – programming paradigm in
which the steps required to execute a program are set
out in the order they need to be carried out.
Object-oriented programming (OOP) – a programming
methodology that uses self-contained objects, which
contain programming statements (methods) and data,
and which communicate with each other.
Class – a template defining the methods and data of a
certain type of object.
Attributes (class) – the data items in a class.
Method – a programmed procedure that is defined as
part of a class.
Encapsulation – process of putting data and methods
together as a single unit, a class.
Object – an instance of a class that is self-contained
and includes data and methods.
Property – data and methods within an object that
perform a named action.
Instance – An occurrence of an object during the
execution of a program.
Data hiding – technique which protects the integrity of
an object by restricting access to the data and methods
within that object.