Object Oriented Programming: 2016-2017
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.
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.
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.
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).
 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.
 How to implement an ADT. Concrete state space, concrete invariant, abstraction function. Implementing operations, illustrated by the Text example.
 Features of object-oriented programming. Encapsulation, object identity, polymorphism – but not inheritance.
 Inheritance in OO design. The fragile base class problem
 Design patterns. Introduction and classification. The iterator pattern.
 Model-view-controller pattern.
 Memento, decorator and command. Commands as methods and as objects.
 Implementing OO language features.
 Memory management.
 Generic types and collections.
[11-12] GUIs. Graphical programming with Scala and Swing
 Speeding up a program
 Testing, verification and validation.
 Code organization and documentation.
 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.
Software architecture. Object-oriented design principles. Design by contract and proof of correctness of data representations. Event-driven programming. Common design patterns. Case studies.
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.
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.
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.