D—Object-oriented programming

D.1 Objects as a programming concept (6 hours)
The paradigm of object-oriented programming should be introduced through discussion and example.

Assessment statement Obj Teacher's notes
D.1.1 Outline the general nature of an
object.
2 An object as an abstract entity and
its components—data and actions.
Familiar examples from different
domains might be people, cars,
fractions, dates and music tracks.
D.1.2 Distinguish between an object
(definition, template or class) and
instantiation.
2 Students must understand the
difference in terms of code
definitions, memory use and the
potential creation of multiple
instantiated objects.
D.1.3 Construct unified modelling language
(UML) diagrams to represent object
designs.
3 LINK Connecting computational
thinking and program design.
D.1.4 Interpret UML diagrams. 3 LINK Connecting computational
thinking and program design.

D.1.5 Describe the process of decomposition
into several related objects.
2 A simple example with 3–5 objects
is suggested. Examples related to
D.1.1 could be employers, traffic
simulation models, calculators,
calendars, media collections.
LINK Thinking abstractly.
AIM 4 Applying thinking skills
critically to decompose scenarios.
D.1.6 Describe the relationships between
objects for a given problem.
2 The relationships that should
be known are dependency
("uses"), aggregation ("has a") and
inheritance ("is a").
LINK Thinking abstractly.
AIM 4 Applying thinking skills
critically to decompose scenarios.
D.1.7 Outline the need to reduce
dependencies between objects in a
given problem.
2 Students should understand that
dependencies increase maintenance
overheads.
D.1.8 Construct related objects for a given
problem.
3 In examinations problems will
require the students to construct
definitions for no more than
three objects and to explain their
relationships to each other and to
any additional classes defined by the
examiners.
LINK Connecting computational
thinking and program design.
AIM 4 Applying thinking and
algorithmic skills to resolve
problems.
D.1.9 Explain the need for different data
types to represent data items.
3 The data types will be restricted to
integer, real, string and Boolean.
D.1.10 Describe how data items can be passed
to and from actions as parameters.
2 Parameters will be restricted to passby-
value of one of the four types in
D.1.6. Actions may return at most
one data item.

Computer science guide


Syllabus content

D.2 Features of OOP (4 hours)
Students should be able to describe the features of OOP that distinguish it from other approaches to
computer programming.

D.2.1 Define the term encapsulation. 1 Data and actions are limited to the
object in which they are defined.
D.2.2 Define the term inheritance. 1 A parent object holds common data
and actions for a group of related
child objects. Multiple inheritance is
not required.
D.2.3 Define the term polymorphism. 1 Actions have the same name
but different parameter lists and
processes.
D.2.4 Explain the advantages of
encapsulation.
3 For example, the scope of data
should be confined to the object in
which it is defined as far as possible
in order to limit side effects and
dependencies.
D.2.5 Explain the advantages of inheritance. 3 For example, a parent object
holds common data and actions,
which enhances reuse and reduces
maintenance overheads.
D.2.6 Explain the advantages of
polymorphism.
3 For example, an action in a child
object may choose to override
actions of a parent object. This
allows an external program to
use the same action on a family
of objects without knowing the
implementation detail.
D.2.7 Describe the advantages of libraries of
objects.
2 For example, sorts and other
complex algorithms and processes
do not have to be "re-invented".
D.2.8 Describe the disadvantages of OOP. 2 For example, increased complexity
for small problems; unsuited to
particular classes of problem.
AIM 9 Develop an appreciation of
the limitations of OOP.

D.2.9 Discuss the use of programming teams. 3 As compared to individuals working
alone. Examples include speed to
completion, information hiding
to reduce module dependencies,
expertise in narrow fields (eg testing,
documentation), etc.
INT, AIM 5 The need to develop
a common "language" to enable
collaboration across international
frontiers when resolving problems.
D.2.10 Explain the advantages of modularity
in program development.
3 Advantages include easier debugging
and testing, speedier completion, etc.

D.3 Program development (20 hours)
Assessment statement Obj Teacher's notes
D.3.1 Define the terms: class, identifier,
primitive, instance variable, parameter
variable, local variable.
1 These are generally related to the
object's data. See JETS.
D.3.2 Define the terms: method, accessor,
mutator, constructor, signature, return
value.
1 These are generally related to the
object's actions. See JETS.
D.3.3 Define the terms: private, protected,
public, extends, static.
1 These are generally related to the OOP
features described in D.2. See JETS.
D.3.4 Describe the uses of the primitive data
types and the reference class string.
2 In examination questions the
primitive types will be limited to int,
long, double, char and Boolean.
MYP Mathematics: forms of numbers.
D.3.5 Construct code to implement
assessment statements D.3.1–D.3.4.
3 Students may be asked to trace,
explain or construct algorithms using
the concepts associated with the
terms.
D.3.6 Construct code examples related to
selection statements.
3 Students may be asked to trace,
explain or construct algorithms using
simple and compound if … else
constructs.
D.3.7 Construct code examples related to
repetition statements.
3 Students may be asked to trace,
explain or construct algorithms using
for, while or do … while loops.
D.3.8 Construct code examples related to
static arrays.
3 Students may be asked to trace,
explain or construct algorithms using
static arrays.

D.3.9 Discuss the features of modern
programming languages that enable
internationalization.
3 For example, use of UNICODE
character sets.
INT When organizations interact,
particularly on an international basis,
there may be issues of language
differences.
D.3.10 Discuss the ethical and moral
obligations of programmers.
3 For example, adequate testing of
products to prevent the possibilities
of commercial or other damage.
Acknowledging the work of other
programmers. The main aims of the
Open Source movement should be
known.
S/E AIM 8 An awareness of the ethical
considerations when developing new
code.

HL Extension

D.4 Advanced program development (15 hours)
Assessment statement Obj Teacher's notes
D.4.1 Define the term recursion. 1
D.4.2 Describe the application of recursive
algorithms.
2 Students should understand that
recursion can be applied to a small
subset of programming problems to
produce elegant solutions. Students
should also understand that recursive
algorithms are rarely used in practice.
LINK Thinking abstractly, thinking
recursively.
D.4.3 Construct algorithms that use
recursion.
3 This is limited to a method that returns
no more than one result and contains
either one or two recursive calls.
LINK Connecting computational
thinking and program design.
D.4.4 Trace recursive algorithms. 2 All steps and calls must be shown
clearly.
LINK Connecting computational
thinking and program design.
D.4.5 Define the term object reference. 1 As typified by simple classes that are
self-referential.
D.4.6 Construct algorithms that use
reference mechanisms.
3

D.4.7 Identify the features of the abstract
data type (ADT) list.
2 Students should understand the
nature of an ADT—where no
implementation details are known but
the actions/methods are standard.
D.4.8 Describe applications of lists. 2 Students should understand that lists
can be used to represent stacks and
queues.
D.4.9 Construct algorithms using a static
implementation of a list.
3 Lists will be restricted to singly linked
types. Methods that should be known
are add (head and tail), insert (in
order), delete, list, isEmpty, isFull.
D.4.10 Construct list algorithms using object
references.
3 Lists will be restricted to singly linked
types. Methods that should be known
are add (head and tail), insert (in
order), delete, list, isEmpty, isFull.
D.4.11 Construct algorithms using the
standard library collections included
in JETS.
3 The classes are ArrayList and
LinkedList. Students should have a
broad understanding of the operation
of these lists and their interface
(methods) but not of the internal
structure.
D.4.12 Trace algorithms using the
implementations described in
assessment statements D.4.9–D.4.11.
2 In examination questions, definitions
of ArrayList and LinkedList methods
will be given where necessary.
D.4.13 Explain the advantages of using library
collections.
3 Students should understand that
libraries provide convenient and
reliable implementations of common
programming tasks.
D.4.14 Outline the features of ADT's stack,
queue and binary tree.
2 Students should be able to
provide diagrams, applications
and descriptions of these ADTs. For
example, they should know that a
binary tree can be used to efficiently
store and retrieve unique keys.
D.4.15 Explain the importance of style and
naming conventions in code.
3 Students should understand
that meaningful identifiers,
proper indentation and adequate
comments all improve the
readability of code for humans and
thus save money, time and effort in
programming teams.
INT, AIM 5 The need to develop
a common "language" to enable
collaboration across international
frontiers when resolving problems.