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.
New material will be updated as the course continues, week by week. You will be able to find these in the following sections.
|Week||Lecture Handout||Exercise||Tutorial Handout||Reading|
Recursion, Lists and Trees
In the Monday (1) lecture, we reviewed recursion from semester 1. On Tuesday (1), we reviewed list examples using recursion. On Wednesday (1), we discussed insertion and deletion in binary search trees.
|-||Weeks 9-10 of semester1, [Deitel & Deitel] Chapter 18|
On Monday (2), we discussed documentation and testing. On Tuesday (2), we discussed height-balanced binary search trees.
|-||Data structures text on AVL trees|
In the Monday (3) lecture, we took an overview of the Collection classes of the JAVA API.
3 Feb and 10 Feb
|Handout||Java Tutorial on Collections, [Deitel & Deitel] Chapter 20|
|03-04||Types and Generics
On Tuesday (3), we talked about Java type system: classes and interfaces, and subtypes. On Wednesday (3), we discussed polymorphism arising from subtyping and generics, and the interaction between subtyping and generics. Monday's (4) lecture was devoted to the typing issues in the "Collections" class.
|-||Java Tutorial on Generics, [Deitel & Deitel] Chapter 21|
|04-05||Graphical user interfaces
On Tuesday (4), we started talking about GUI's. On Wednesday (4), we talked about event handling. On Tuesday (5), we talked about layout management. On Wednesday (5), we talked about Model-View separation using the Observer pattern.
Dictionary class (zip file)
Demo application (jar file)
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. On Wednesday (6), we discussed issues of deadlock and starvation, started talking about sockets.
Team project worksheet
Due: 23 Mar
|-||Java tutorial on concurrency, [Deitel & Deitel] Chapter 26|
On Monday (7), we looked at Java's Socket classes for building client-server applications. On Tuesday and Wednesday, we talked about a number of issues of software development: design, architecture, interfaces/specifications, testing methods, exception handling and version control using Subversion (SVN).
on sockets, exceptions,
[Deitel & Deitel] Chapters
On Monday (8), we talked about how to use JDBC to access databases from Java programs.
|-||-||Java tutorial on JDBC, [Deitel & Deitel] Chapter 28|
|Week||Lecture Handout||Exercise||Tutorial Handout||Reading|
|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
Due: 9 Oct 12:00 noon
|-||[Deitel & Deitel] Chapters 1 and 2 on Intro to Computers, the Internet and the Web and Introduction to Java Applications.|
|2||Conditionals, `for' Loops, arrays, JUnit, Eclipse
On Wednesday we first went over the material about types and static methods, then we introduced the `if' conditional and `for' loops, one-dimensional and two-dimensional arrays and introduced the basics of JUnit tests.
Due: 23 Oct 12:00 noon
|s1wk2||[Deitel & Deitel] Chapters 4 and 5 on Control Statements, and 7.1-7.10 on Arrays|
|3||static methods (Cont'), recursion (factorial, Fibonacci), case, while, more examples
We intoduced more conditional and loop constructs, saw more examples and then moved to recursive methods. On Friday we went through some exercises which each student could work on on their own pace.
|-||s1wk3||[Deitel & Deitel] Chapters 4 and 5 on Control Statements, Chapter 18 on Recursion|
On Wednesday we introduced classes, objects, and methods and looked at two examples, Date and BankAccount
Due: 13 Nov 12:00 noon
|s1wk4||[Deitel & Deitel] Chapters 3, 6, and 8.1-8.13 on Classes, Objects, and Methods|
|5||Wed: Exceptions, assertions, I/O, Patterns
Fri: In-class test
First, we revisited classes, then looked at exceptions for file handling, a user interface, and other uses.
|-||s1wk5||[Deitel & Deitel] Chapter 11 on ExceptionHandling, Chapter 16 on Strings and Regular Expressions, 17.1-17.5 on I/O|
In the first lecture on Wednesday we looked in detail at the in-class test and common problems that occurred in the answers. In the second hour we looked at interfaces (in the sense of contracts for an implementation). Friday - lab lecture with in lab exercises.
|-||s1wk6||[Deitel & Deitel] 10.7 on Interfaces|
|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
|-||s1wk7||[Deitel & Deitel] Chapters 9 and 10 on Inheritance and Polymorphism|
|8||Inheritance (Cont'd), packages
We discussed packages and two more access types in addition to public and private, abstract methods, and final methods
Due: 30 Nov 5pm
|[Deitel & Deitel] 7.11-7.16 on ArrayLists and 8.14-8.17 on packages|
|9||Recursion on structures (lists, binary trees)
On Wednesday we first revised recursive methods and then introduced the class List as a first recursive structure. I.a. we wrote jointly an equals method.
Due: 10 Dec 2pm
|s1wk9||[Deitel & Deitel] re-read Chapter 18 on Recursion|
|10||Recursion (Cont'd), Queues
Fri: In-class test
We were revisiting lists and trees. In the second hour we looked at at naive version of queues and at an efficient implementation
Last year's and this year's exam papers can be found locally as java13.pdf and java14.pdf. Now also available java15.pdf .In some of the lab lectures we had exercise sheets. These can be found in handouts/labExercises.
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.
- 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.