Principal lecturer: Dr Robert Harle
Taken by: Part IA CST, Part IA NST, Part I PPS
Past exam questions
Information for supervisors (contact lecturer for access permission)
**** Sample tripos questions now available on this page ****
The handout provided in Lecture one is available
by clicking here.
Annotated PDFs are also available
Some of you asked for a copy of the slides from the final lecture
(which has a summary of the course at the end):
they are available here.
The original handout is a bit weak on the pass by refernce stuff.
Hopefully the extra notes below and what I said in the lectures will
mean it doesn't matter to you. However, for clarity: Jave is purely
"pass by value": every function argument is copied (=pass by value),
BUT only primitives and references can be passed (so actual object
don't end up being copied).
On slide 68 I have some code that says "if (b==0) throw
DivideByZeroException();". This actually won't compile becuse it
tries to call a constructor without the new command. What I meant
to say was "if (b==0) throw new DivideByZeroException();"
The generic diagram for the Abstract Factory is wrong.
ConcreteFacory1 should create only ProductA1 and ProductB1, whilst
ConcreteFactory2 produces ProductA2 and ProductB2. I have updated
the annotated notes above to reflect it (but your handout is wrong:
In lecture 2 I showed some code to illustrate reference handling. I
know some people didn't completely get it so I have prepared an
addendum to the notes that goes through
it. Click here to see it.
Sample Exam Questions
I have started to produce a few sample exam questions for the
course since there isn't much of a history for you to try. You will
find them here: Sample Exam
Questions. The feedback system provided me with a convenient list
of users IDs: if you didn't fill out a feedback form for the course,
you will need to email me for access to this page.
In addition, some of the old Java course questions are relevant
(you'll need to apply common sense to decide whether the question is
appropriate. If you're worried, email me and I will tell you whether
a question is appropriate).
You may also wish to look at the Programming Methods
tripos question from last year. I also wrote some
sample exam questions for that
with solutions. They are
mostly (but not completely) applicable to the OOP course: they're
certainly good practice.
Some of you have asked about the programming environment I'm using
in lectures. This is a free program called Eclipse and you can
from here. You can
download various add-ons to support different programming languages,
but if you download and install the "Eclipse IDE for Java
Developers" you should find that has everything you need for Java
If you're wondering why we don't use it with you in the ticks, it's
because we're trying to do two things: i) teach you Java, and ii)
make you familiar with UNIX (which is very popular, especially in
scientific circles). The eclipse platform is great, but it masks
away the UNIX stuff and can be quite bewildering. Once you're
proficient in Java, using a tool like Eclipse is highly
recommended. But for now, stick to UNIX.
If you're looking for a way to do your ticks from home, you can
download the Java tools (compiler, virtual machine,
Alternatively you can login the PWF from your room
(see here and here
If there's any code from the lectures you'd like to see, please let
me know and I'll put it up here.
The basic code we developed in lectures is here: Vector2D.java
Cloning is a bit of a minefield but you learn a lot from studying
it. If you want to look over the basic example from lectures you'll
need the following: Address.java CloneExample.java Person.java
The code we developed in lectures
is here. Note I have edited it
slightly to include comments andto make the constructor protected so
you can use it to play with cloning it.