Skip to main content

Object Oriented Programming:  2012-2013

Lecturer

Degrees

Part A CoreComputer Science

Part AMathematics and Computer Science

Schedule AMSc in Advanced Computer Science

Term

Overview

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 analyses 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.

The first half of the course focuses on the role that various OO language features play in the design of complex systems. In particular, the course reviews the principles of design-by-contract and the role of inheritance to express the contracts, the usage of generics (aka templates in languages such as C++), the distinction between equality and identity, and the fundamental principles of memory management.

The second half of the course discusses the use of various design patterns. Particular attention is paid to model-view-controller pattern and the strict separation between the model, the views, and the controllers. In addition, significant attention is paid to the distinction between reuse by inheritance and reuse by composition, as illustrated by the Composite, State, Template Method, and Strategy patterns.

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 object-oriented design principles such as separation of concerns, responsibility analysis, and design by contract, and
  • be conversant with the most important design patterns.

Prerequisites

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 option, please note that you should undertake preparatory reading before taking the course; see the reading list for details. People without a solid programming background should not take this course.

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.

Synopsis

  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.

Syllabus

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

Essential

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

Taking our courses

This form is not to be used by students studying for a degree in the Department of Computer Science, or for Visiting Students who are registered for Computer Science courses

Other matriculated University of Oxford students who are interested in taking this, or other, courses in the Department of Computer Science, must complete this online form by 17.00 on Friday of 0th week of term in which the course is taught. Late requests, and requests sent by email, will not be considered. All requests must be approved by the relevant Computer Science departmental committee and can only be submitted using this form.