MSc/ICY Java Workshop

Welcome to the pages for the MSc/ICY Software Workshop 1 & 2 at the School of Computer Science. You should bookmark this page as you will need to refer to this site frequently throughout the course.

Errors/mistakes on the handouts and worksheets are corrected here.

Course Material

New material will be updated as the course continues, week by week. You will be able to find these in the following sections.

Semester 2

WeekLecture HandoutExercise Tutorial HandoutReading
01 Review of Recursion, Lists and Trees
In the Monday (1) lecture, we looked at recursion. On Tuesday (1), we looked at list examples using recursion. On Thursday (1), we completed the discussion of recursion and list examples in the slides.
Worksheet 1
21 Jan
Starter pack
- Weeks 9-10 of semester1, [Deitel & Deitel] Chapter 18
02-03 Recursive data structures (contd)
On Monday (2), we discussed documentation and testing. On Tuesday (2), we looked at the data structure of binary trees, and on Thursday (2), we discussed binary search trees.
On Monday (3), we discussed height-balanced binary search trees (AVL trees).
Worksheet 2
2 Feb
Starter pack
- Wikipedia article on AVL trees, Your data structures text
03Collections library

In the Tuesday (3) lecture, we took an overview of the Collection classes of the JAVA API. On Thursday (3), we talked about the Map classes and did an example of frequency counting.
- Java Tutorial on Collections, [Deitel & Deitel] Chapter 20
04Types and Generics
On Monday (4), we talked about Java type system: classes and interfaces, and subtypes. On Thuesday (4), we discussed polymorphism arising from subtyping and generics, and the interaction between subtyping and generics.
Worksheet 3
9 Feb and 16 Feb Verify files
Handout Java Tutorial on Generics, [Deitel & Deitel] Chapter 21
04-05 Graphical user interfaces
On Thursday (4), we started talking about GUI's. On Tuesday (5), we talked about event handling. On Thursday (5), we talked about layout management and Model-View separation using the Observer pattern.
Monday (4) was devoted to Class Test 1.
Worksheet 4
23 Feb

Dictionary class (jar file)

Demo application (jar file)
- Java Tutorials on Swing Components, Lambda expressions and
Layout [Deitel & Deitel] Chapter 14
06 Threads and concurrency
On Monday (6), we started talking about concurrent threads. On Tuesday (6), we looked at example programs with threads, and talked about the problem of deadlock. On Thursday (6), we reviewed again the issues of synchronisation, deadlock and starvation. I also introduced sockets, to be continued.
Team project worksheet
Due: 23 Mar
- Java tutorial on concurrency, [Deitel & Deitel] Chapter 26
07 Networking, Software Development
On Monday (7), we looked at Java's Socket classes for building client-server applications. On Tuesday and Thursday, we talked about a number of issues of software development: design, architecture, interfaces/specifications, testing methods, exception handling and version control using Subversion (SVN).
- - Java tutorials on sockets, exceptions, [Deitel & Deitel] Chapters
27-Networking, 11-Exceptions
08 Database Connectivity
- - Java tutorials on JDBC, Properties files
[Deitel & Deitel] Chapter 28

Semester 1

WeekLecture HandoutExercise Tutorial HandoutLab LectureReading
1 Introduction - simple computations, types, variables, static methods

On Wednesday we look at pocket calculator computations, the 8 basic types in Java, simple strings, variables, static methods, compilation and documentation extraction
On Friday we have a lab lecture (login, editor, javac, javadoc)

Contrib: 0
Due: 8 Oct 14:00
- 1 [Deitel & Deitel] Chapters 1 and 2 on Intro to Computers, the Internet and the Web and Introduction to Java Applications.
2 Classes, objects, JUnit, Eclipse

On Wednesday we introduced classes, objects, and methods and looked at two examples, Date and BankAccount, on Friday at the Eclipse Integrated Development Environment and JUnit testing

Contrib: 5
Due: 22 Oct 14:00
Tutorial Handout 2 [Deitel & Deitel] Chapter 3 on Classes and Objects
3 Conditionals, `for' Loops, arrays, ArrayList

We intoduce conditional and loop constructs, see more examples.

- Tutorial Handout 3 [Deitel & Deitel] Chapters 4 and 5 on Control Statements, Chapter 7 on Arrays and ArrayLists
4 Exceptions, Input/Output

We introduce exceptions as a way to handle problems that may occur for reasons such as a non-valid argument to a procedure, or a file not existing. We looked also at file I/O and a non-graphical user interface

Contrib: 12.5
Due: 5 Nov 14:00
Tutorial Handout 4 [Deitel & Deitel] Chapters 11, 15 on Exception Handling, Strings, Files
5 Interfaces

In the first hour on Wednesday we discussed the questionnaire feedback, in the second we introduced interfaces with the Payable interface.

- Tutorial Handout 5 [Deitel & Deitel] 10.9 on Interfaces
6 Inheritance

We looked on Wednesday at inheritance and used two examples in a hierarchy, first users of a library, and second bank accounts and bank accounts with overdraft. On Friday was the first in-class test.

Contrib: 12.5
Due: 19 Nov 14:00
Tutorial Handout - [Deitel & Deitel] Chapters on Inheritance
7 Sub classes, inheritance

We looked on Wednesday at inheritance and used two examples in a hierarchy, first users of a library, and second bank accounts and bank accounts with overdraft

- Tutorial Handout 7 [Deitel & Deitel] Chapters 9 and 10 on Inheritance and Polymorphism
8 Graphics

We looked at different graphic components to put on a panel on a frame. We looked also at an interactive way to display chess

Contrib: 12.5
Due: 3 Dec 14:00
- 8 [Deitel & Deitel] Chapter 13 on Graphics and Java 2D
9 GUI Components

We gave a general introduction to GUIs and looked in detail in the Friday lecture at the Model-View-Controller framework

- - 9 [Deitel & Deitel] Chapter 12 on GUI Components Part I
10 GUI Components (Cont'd)

We were looking at more examples of GUIs and layouts
Fri: In-class test

- - - [Deitel & Deitel] Chapter 22 on GUI Components Part II
11 Revision

- - -

The first in-class tests of 2013, 2014, and 2015 can be found locally as inclass2013a.pdf, inclass2014a.pdf, and inclass2015a.pdf.

The second in-class tests of 2013 and 2014 can be found locally as inclass2013b.pdf, inclass2014b.pdf, and inclass2015b.pdf, (Note that in 2015 we do not cover recursive data types in Term 1, that is, the corresponding questions are irrelevant for the second test in 2015.)

Last years' exam papers can be found locally as java13.pdf, java14.pdf, java15.pdf, and java16.pdf.

Useful Resources

If you get stuck, the first port of call is research. Here are some links which will help you get started, and access to resources to help build confidence around this subject.

  • A very well elaborated suite of increasingly more difficult coding exercises can be found at coding pages developed by Chua Hock-Chuan.
  • Coding Bat Java Challenges A series of Java challenges, you can try in the browser, and then see your performance tested straight away. Useful for getting in a few extra hours practice, on some puzzlers.
  • Java Library Documentation: On this course, we use primarily use Java 1.6 SE. The API (Application Programming Interface) reference contains information about the built in Java SDK (Software Development Kit) library code. You will need this when you start to use library code. You will also learn how to create an API, like the java one, for your own code.
  • Java Style: Java is a High-Level, Object Oriented Language, however you're code still needs to be easy to read. As a result there are many conventions, and guide lines, on how to write readable code that is easy to understand.
  • Documenting Java Code: Any code you write should be documented. Java advocates a particular structure of documentation, which the Javadoc tool can automatically turn into API reference documents (such as those mentioned above). This overview on how to structure code documentation for Javadoc provides the essentials. The Javadoc documentation provides full details, and finally there are guidelines on how to describe, inside such documentation comments, the actual behaviour of your program.
  • Java Trails: The Java Trails are a set of tutorials maintained by Oracle, the current Java developers. They are designed to get you programming Java from scratch, including lots of worked examples. They have been updated to cover Java 7, the latest version of Java, which is slightly newer that the version we run in labs, so be warned that some features they describe are not available for use in the School (e.g. switch statements on Strings).
  • JUnit: We use JUnit 4 for testing. Our JUnit cheatsheet explains the very basics. You may find further information on the JUnit homepage. Initially we will be using JUnit from the command line, but note that integrated development environments such as Eclipse also have built-in JUnit support.
  • Downloading Java Software Development Kit: If you wish you can download the Java Software Development Kit for use on your own computer for free from the SUN Java website JDK Download, choose "Java SE Development Kit (JDK)". However, we can not answer question about getting Java working on your own computer and strongly recommend you use the lab computers to complete your exercises. Your code may not work if you create it in a different environment to where you expect to run it, some of your exercises may be demonstrated in the lab and must work on lab machines.
  • Linux: The lab machines use the open source Linux Operating System, as opposed to more popular operating systems such as Microsoft Windows or Apple OSX. If you are considering using Linux at home the distribution of Linux used in the labs is CentOS 5 but you might well find Ubuntu to be a more user friendly Linux Distribution. There is usually a Linux install party every year in the student common room, where other students will help you with all aspects of installing Linux on your own computer (we will let you know about this on the blog).
    There is a short course on Unix available here.