Course pages 2012–13
Lecturer: Dr R.K. Harle
No. of lectures: 11
Suggested hours of supervisions: 4
Companion practical course: Programming in Java
This course runs in parallel with the Programming in Java practical course. It is intended to provide both an introduction to Java that complements the practical workbooks and to highlight the abstract notion of object-oriented programming. Examples and discussions will use Java primarily, but other languages may be used to illustrate specific points where appropriate.
- Hardware Refresher. Fetch-execute cycle. Registers. System Architectures. Imperative languages as closer to the hardware. The JVM idea. [1/2 lecture]
- Programmer’s Model of Memory. Primitive Types. Pointers. References. Pass-by-value and pass-by-reference. Reference Types. [1/2 lecture]
- OOP Concepts. Objects vs classes. Identifying objects. Distinguishing state and behaviour. UML class diagrams. Modularity. Encapsulation. Inheritance. Casting. Polymorphism. Abstract Classes. Multiple inheritance. Java interfaces. Representing class-level data. Exceptions in brief. [3 lecture]
- Lifecycle of an Object. Constructors. Destructors. Garbage Collection. [1/2 lecture]
- Copying Objects. Copy constructors. Cloning in Java. Cloneable as a marker interface in Java. [1/2 lecture]
- Comparing Objects. Comparing primitive types. Comparing reference types. Comparable and Comparator in Java. [1 lecture]
- Templates and Generics. Java Collections framework as motivation. Examples of generic programming. [1 lecture]
- Design patterns and design examples. Introduction to design patterns. Applying design patterns to example problems. Design patterns in the Java class library. Examples of building a Java program from problem statement to testing. [2 lectures]
- Case studies.
- Common Java errors. The need for care with syntax. Numerical overflow and other common problems. [if time allows]
At the end of the course students should
- understand the principles of OOP;
- be able to demonstrate good object-oriented programming skills in Java;
- understand the capabilities and limitations of Java;
- be able to describe, recognise, apply and implement selected design patterns in Java;
- be familiar with common errors in Java and its associated libraries.
No single text book covers all of the topics in this course. For those new to OOP, the best introductions are usually found in the introductory programming texts for OOP languages (such as Java, python or C++). Look for those that are for people new to programming rather than those that are designed for programmers transitioning between languages (the Deitel book is highlighted for this reason). The web is also a very useful resource -- look for Java tutorials.
* Deitel, H.M. & Deitel, P.J. (2009). Java: How to Program. Prentice Hall (8th ed.).
Flanagan, D. (2005). Java in a nutshell : a desktop quick reference. O’Reilly (5th ed.).
Flanagan, D. (2004). Java examples in a nutshell : a tutorial companion to Java in a nutshell. O’Reilly (3rd ed.).
Gamma, E., Helm, R., Johnson, R. & Vlissides, A. (1995). Design patterns: elements of reusable object-oriented software. Addison-Wesley.
Bloch, J. & Gafter, N. (2005). Java puzzlers. Addison-Wesley.