Skip to main content

Object Oriented Programming:  2017-2018

Overview

This course aims to prepare undergraduates for the programming work they will undertake during their time in Oxford and subsequently, including subsequent programming-heavy courses such as Compilers and Database Systems Implementation, in addition to the group project and later individual project work. The course contains few topics that have not been mentioned in previous courses, but the defining aim in this course is to illustrate those programming techniques put to work in a sequence of case studies of carefully chosen size, each of them big enough to have significant internal interfaces, but not so large as to be overwhelming. The course will introduce standard tools and techniques for software development: use of a version control system, an automated build process, an approriate framework for automated unit and integration tests, and profiling tools for studying performance. Participants will be able to choose between an IDE and a traditional editor/compiler setup.

Learning outcomes

After taking the course, participants will be able to

  • Specify simple abstract data types and design implementations, using abstraction functions to document them.
  • Recognise features of object-oriented design such as encapsulation, polymorphism, inheritance, and composition of systems based on object identity.
  • Name and apply some common object-oriented design patterns and give examples of their use.
  • Design applications with an event-driven graphical user interface.

Prerequisites

This is not a first programming course; neither is it a course about Scala. Most undergraduates taking the course will have had a previous introduction to Scala in the course Imperative Programming II that they took in the first year. Since we will be using mostly those features of Scala that are also present (in slightly more clunky form) in Java, it should not be too difficult for those already familiar with Java to pick up the language they need to follow the course. Familiarity with elementary notions of program correctness will be assumed, such as pointer-linked data structures and the use of invariants to reason about programs containing loops.

Synopsis

This page gives a lecture-by-lecture synopsis of the course, supplemented by links to printed lecture notes and handouts.

Note that there is some early overlap/revision of material in Imperative Programming II (particularly the fundamentals of Abstract Data Types).

[1] Abstract data types and their specification. Programming for change by separation of concerns. Operations with pre- and post-conditions, illustrated by the Text example and others.

[2] How to implement an ADT. Concrete state space, concrete invariant, abstraction function. Implementing operations, illustrated by the Text example.

[3] Features of object-oriented programming. Encapsulation, object identity, polymorphism – but not inheritance.

[4] Inheritance in OO design.  The fragile base class problem

[5] Design patterns. Introduction and classification.  The iterator pattern.

[6] Model-view-controller pattern.

[7] Memento, decorator and command. Commands as methods and as objects.

[8] Implementing OO language features.

[9] Memory management.

[10] Generic types and collections.

[11-12] GUIs. Graphical programming with Scala and Swing

[13] Speeding up a program

[14] Testing, verification and validation.

[15] Code organization and documentation.

[16] The software development process.

Note for tutors: the schedule given here is a plan. We may alter the speed and/or content of the course if we perceive a need.

Syllabus

Software architecture. Object-oriented design principles. Design by contract and proof of correctness of data representations. Event-driven programming. Common design patterns. Case studies.

Reading list

Essential

There is no set text for the course, in the sense of a book that we will work our way through, lecture by lecture. The closest book in spirit to the course is

Barbara Liskov, Program Development in Java, Addison-Wesley, 2001, £47.99, ISBN 0201657686.

except that we shall be emphasizing programming examples much more than that book – and our programs will be written in Scala not Java.

As a guide to Scala, we will use

Martin Odersky, Lex Spoon and Bill Venners, Programming in Scala.

Optional

For reading around the course, I recommend a number of other books. The structure of our programs will resonate with some of the 'design patterns' that have become a popular way to think about object-oriented programs. A chatty and accessible introduction to design patterns is this book:

Head First Design Patterns by Freeman and Freeman

The design patterns movement started with the book,

Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, John Vlissides, Ralph Johnson, and Richard Helm.
This book is sometimes referred to by the community as "The gang of four book" (or GOF).

Also helpful as an account of design by contract is

Bertrand Meyer, Object-Oriented Software Construction, SAMS, 1997, £35.37, ISBN 0136291554.

This book is based on the Eiffel language invented by the author rather than Scala.

Here is a book about restructuring programs to make them more clear, the program maintenance counterpart of modular design. It resonates well with the lecturer's experience of designing for clarity and robustness.

Martin Fowler, Refactoring: improving the design of existing code, Addison-Wesley, 2000, £37.99, ISBN 0201485672.

Also the following books about programming more generally would be good companions to the course:

Jon Bentley, Programming Pearls (2nd ed.), Addison-Wesley, 2000, £21.99, ISBN 0201657880.
Brian W. Kernighan and Rob Pike, The Practice of Programming, Addison-Wesley, 1999, £22.99, ISBN 020161586X.