skip to primary navigationskip to content

Department of Computer Science and Technology

Part IA CST

 

Course pages 2023–24

Object-Oriented Programming

Principal lecturer: Dr Robert Harle
Taken by: Part IA CST
Term: Michaelmas
Hours: 12
Format: In-person lectures
Suggested hours of supervisions: 3
This course is a prerequisite for: Concurrent and Distributed Systems, Further Java, Multicore Semantics and Programming
Exam: Paper 1 Question 3, 4
Past exam questions, Moodle, timetable

Aims

The goal of this course is to provide students with an understanding of Object-Oriented Programming. Concepts are demonstrated in multiple languages, but the primary language is Java.

Lecture syllabus

  • Types, Objects and Classes Moving from functional to imperative. Functions, methods. Control flow. values, variables and types. Primitive Types. Classes as custom types. Objects vs Classes. Class definition, constructors. Static data and methods.
  • Designing Classes Identifying classes. UML class diagrams. Modularity. Encapsulation/data hiding. Immutability. Access modifiers. Parameterised types (Generics).
  • Pointers, References and Memory Pointers and references. Reference types in Java. The call stack. The heap. Iteration and recursion. Pass-by-value and pass-by-reference.
  • Inheritance Inheritance. Casting. Shadowing. Overloading. Overriding. Abstract Methods and Classes.
  • Polymorphism and Multiple Inheritance Polymorphism in ML and Java. Multiple inheritance. Interfaces in Java.
  • Lifecycle of an Object Constructors and chaining. Destructors. Finalizers. Garbage Collection: reference counting, tracing.
  • Java Collections and Object Comparison Java Collection interface. Key classes. Collections class. Iteration options and the use of Iterator. Comparing primitives and objects. Operator overloading.
  • Error Handling Types of errors. Limitations of return values. Deferred error handling. Exceptions. Custom exceptions. Checked vs unchecked. Inappropriate use of exceptions. Assertions.
  • DesignLanguage evolution Need for languages to evolve. Generics in Java. Type erasure. Introduction to Java 8: Lambda functions, functions as values, method references, streams.
  • Design Patterns Introduction to design patterns. Open-closed principle. Examples of Singleton, Decorator, State, Composite, Strategy, Observer. [2 lectures]

Objectives

At the end of the course students should

  • Provide an overview of key OOP concepts that are transferable in mainstream programming languages;
  • Gain an understanding of software development approaches adopted in the industry including maintainability, testing, and software design patterns;
  • Increase programming familiarity with Java;

Recommended reading

1. Real-World Software Development: A Project-Driven Guide to Fundamentals in Java [Urma et al.]
2. Modern Java in Action (2nd edition) [Urma et al.].
3. Java How to Program: early objects [Deitel et al.]