Skip to main content

Object Oriented Programming:  2009-2010



Part A CoreComputer Science

Part AMathematics and Computer Science

Schedule AMSc in Computer Science

MSc by Research



Students attending this course are expected to acquire advanced skills in object-oriented programming and design. The course particularly focuses on the design aspects of object-oriented programming and concepts such as responsibility and collaboration analysis, and designing for change. All examples in this course are given in the Java programming language, and the design aspects are presented in UML by means of class and sequence diagrams.

All the material in this course is based on a single case study of building a vector graphics application. The course starts by specifying the application requirements, and then continues by designing the application architecture. The design is firmly grounded in the responsibility analysis of the system's components, the principle of the separation of concerns, loose coupling and high cohesion, and design by contract.

The requirements are successively modified and amended with fresh functionality such adding new graphical objects. The course analyzes how the changes in the requirements impact the system's architecture, and how the principles of object-oriented programming can be used to minimize this impact.

Significant attention is paid to the role of design patterns in object-oriented design as a means of developing software architectures that are resilient to change in the requirements.

Learning outcomes

By attending this course,students satisfying the prerequisites are expected to

  • understand the fundamental principles of object-oriented design,
  •  be able to apply the design principles such as separation of concerns, responsibility analysis, design by contract, and the Law of Demeter to software engineering problems, and
  •  be conversant with the most important design patterns.


MSc students: This course is only suitable for those with a solid programming background who wish to learn more about Object Oriented Programming and modular program design.  If you decide to take this ption please note that you should undertake preparatory reading before coming to Oxford; see reading list for details.  People without a solid programming background should not attempt this topic.

This is NOT a course about Java: students are expected to be already familiar with Java, the basic concepts of object orientation such as classes, interfaces, members, and methods, and the principles of imperative programming languages. Also, this is NOT a course about the usage of Java libraries: students are expected to be able to learn about various API calls available in Java's Software Developer Kit by themselves.



  1. Requirements: use cases, actors, preconditions, basic course of events, alternative paths, postconditions. Example: a publishing support system for graphical page layout.
  2. Software Architecture: what is a software architecture? UML as a tool for architecture description: class diagrams, sequence diagrams. Example: event-driven architecture.
  3. OO Design Principles: encapsulation, separation of concerns, collaboration analysis, high cohesion, weak coupling, design by contract. Example: the design of the model and view components of the example system.
  4. Inheritance in OO Design: encapsulation, polymorphism, overriding, implementation inheritance, contracts and inheritance, multiple inheritance, structure inheritance, inheritance vs. composition. Example: inheritance in the model of the example system.
  5. Generic Types and Collections: type parameters, implementing generics, templates vs. type erasure; Java collections, iterators; state machine as a specification mechanism. Example: using Java collections in the model of the example system.
  6. Object Identity: identity vs. equality, aliasing, deep vs. shallow copy, aggregation vs. composition, value vs. reference objects. Example: analysis of object identity in the model of the example system.
  7. Memory Management: static, stack-based, and heap-based memory allocation, garbage collection, reference counting, mark-and-sweep, weak references, finalizers vs. destructors, memory leaks. Example: implementing internable objects.
  8. Model-View-Controller: relationship to the Observer pattern, Hollywood principle, event-driven programming. Example: applying the MVC pattern in the example system.
  9. Model-View Separation Revisited: separation of concerns, domain vs. technology cohesion, Visitor pattern and double dispatch, parallel hierarchies, Factory method pattern, Singleton pattern. Example: refactoring the model and the view in the example system.
  10. Testing OO Systems: types of testing (unit, integration, and application testing), test frameworks, mock objects, black-box vs. white-box testing, regression testing, test-driven programming. Example: testing the example system.
  11. Template Method and Strategy Patterns: delegates, separation of concerns, weak coupling. Example: computing the layout of article text with variations (left- and right-justified, centred, and aligned).
  12. Code Organization and Documentation: packages, package diagrams, layering, documentation, Javadoc. Example: identifying packages in the example system, adding documentation.
  13. State Pattern: changing object type "at runtime", Null-Object pattern. Example: adding different tools: pick tool, create article element tool, and create line tool.
  14. Adapter and Decorator Patterns: inheritance vs. composition, reusability. Examples: reusing Java's component for pictures, adding a shadow underneath the graphical shapes.
  15. Composite Pattern: inheritance vs. composition. Examples: adding the “group” tool.
  16. Object Creation Patterns: abstract factory, factory methods, covariance and contravariance. Example: changing selected shapes into other shapes.


Use case gathering. Software architecture. Using UML in object-oriented design. Object-oriented design principles. Design by contract. Event-driven programming. Common design patterns.


Reading list



Peter Sestoft: Java Precisely, Second Edition. September 2005. MIT Press, ISBN: 0262693259


Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides: Design Patterns. March 1995. Addison-Wesley Longman, ISBN: 0201633612


Very Useful


Bertrand Meyer: Object-oriented Software Construction. May 1997. Prentice-Hall International, ISBN: 0136291554


Potentially Useful


Martin Fowler, Kendall Scott: UML Distilled: A Brief Guide to the Standard Object Modeling Language, Second Edition. August 1999. Addison-Wesley Professional, ISBN: 020165783X