Object Oriented Programming: 2009-2010
Part A Core — Computer Science
Part A — Mathematics and Computer Science
Schedule A — MSc in Advanced Computer Science
Michaelmas Term 2009 (16 lectures)
OverviewStudents 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.
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.
- Requirements: use cases, actors, preconditions, basic course of events, alternative paths, postconditions. Example: a publishing support system for graphical page layout.
- Software Architecture: what is a software architecture? UML as a tool for architecture description: class diagrams, sequence diagrams. Example: event-driven architecture.
- 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.
- 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.
- 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.
- 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.
- 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.
- Model-View-Controller: relationship to the Observer pattern, Hollywood principle, event-driven programming. Example: applying the MVC pattern in the example system.
- 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.
- 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.
- 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).
- Code Organization and Documentation: packages, package diagrams, layering, documentation, Javadoc. Example: identifying packages in the example system, adding documentation.
- State Pattern: changing object type "at runtime", Null-Object pattern. Example: adding different tools: pick tool, create article element tool, and create line tool.
- Adapter and Decorator Patterns: inheritance vs. composition, reusability. Examples: reusing Java's component for pictures, adding a shadow underneath the graphical shapes.
- Composite Pattern: inheritance vs. composition. Examples: adding the “group” tool.
- 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.
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
Bertrand Meyer: Object-oriented Software Construction. May 1997. Prentice-Hall International, ISBN: 0136291554
Martin Fowler, Kendall Scott: UML Distilled: A Brief Guide to the Standard Object Modeling Language, Second Edition. August 1999. Addison-Wesley Professional, ISBN: 020165783X
Students are formally asked for feedback at the end of the course. Students can also submit feedback at any point here. Feedback received here will go to the Head of Academic Administration, and will be dealt with confidentially when being passed on further. All feedback is welcome.