Imperative Programming Part 3: 2019-2020
This course builds on the material taught in Imperative Programming Parts 1 and 2 and extends the principles of imperative programming developed there to the design and development of larger programs. It introduces the idea of object-oriented design and illustrates this idea with case studies.
This course aims to prepare undergraduates for the programming work they will undertake during their time in Oxford and subsequently, especially in the group project and later individual project work.
The course will introduce standard tools and techniques for software development: use of a version control system, an automated build process, an appropriate 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
- Explain standard features of object-oriented design such as encapsulation, polymorphism, inheritance, and composition of systems based on object identity.
- Use these features effectively to design and build software.
- Describe some common object-oriented design patterns and give examples of how they should be used.
- Design applications with an event-driven graphical user interface.
· Objects: encapsulation; separation of concerns; loose coupling and high cohesion; object identity; object equality; sub-typing polymorphism.
· Inheritance: uses of inheritance; dynamic binding; overriding and overloading; problems with inheritance; inheritance versus composition.
· Design patterns; introduction to patterns; encapsulation; inheritance; exceptions; iteration; introduction to the text editor example.
· Model-view-controller and command patterns.
· Implementing undo; memento and decorator.
· Testing larger programs: unit testing; integration testing; regression testing; system testing; metrics; test-driven development.
· Iterator and adapter.
· Polymorphism: type bounds; invariance, covariance and contravariance; generic types and collections; Scala collections hierarchy.
· GUI programming: use of a GUI framework; the AutoSnail case study.
· Code organization and documentation: sources of problems; packages; version control systems; code clarity; documentation; comments.
· Overview of the software development process.
Software architecture. Object-oriented design principles. Common design patterns. Event-driven programming. Case studies.
There is no set text for the course, in the sense of a book that is followed by the lectures.
The course will be taught using the Scala programming language. As a guide to Scala, you might use
- Programming in Scala by Martin Odersky, Lex Spoon and Bill Venners, published by Artima Inc
For reading around the course, I recommend a number of other books. A chatty and accessible introduction to design patterns that some will find enlightening and some will find infuriating is this book:
Head First Design Patterns by Eric Freeman and Elisabeth Robson, published by O’Reilly.
The design patterns movement started with the following book, and every serious programmer should be aware of it. It is sometimes referred to as "The gang of four book" (or GOF).
Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, published by Addison-Wesley.
The following is helpful as a principled account of design by contract, but it is based on the Eiffel language invented by the author rather than Scala.
Object-Oriented Software Construction, by Bertrand Meyer, published by SAMS.
The following is a helpful book about restructuring programs to make them more clear, the program maintenance counterpart of modular design:
Martin Fowler, Refactoring: improving the design of existing code, published by Addison-Wesley.