Training Courses from John Deacon

Link to home page
Link to training page
Link to consulting page
Link to PPARC page
Link to personal details
Link to contact information

Advanced Java

A John Deacon training course

This modular, four-day course will complete participants' understanding of Java programming. The course is based on the original Advanced Java course but has been augmented, partly because of the major extensions to the language that Java 5 (JDK 1.5) brought. The course comprises two days of advanced Java language and programming topics, plus two days on the core J2SE library packages. The two components can be taken separately or together. When taken together they are equivalent to an extended version of the original three-day Advanced Java course.

Aims

  • To complete an in-depth knowledge of Java's syntax;
  • To know and to have used the library packages that most developers are likely to need;
  • To be aware of, and to have used, the enhancements that Java 5 brought to the language and the libraries.

Background

One of Java's excellent characteristics is its simplicity and its purity compared, say, with C++ or even C#. Language features that weren't clearly required were not included in the earliest releases but, instead, had to prove that they were necessary. One or two changes were made at the time of JDK 1.1. but most of the eagerly awaited extensions to the language have been made recently, in JDK 1.5. (Although to ensure that Java version numbers continue their tradition of being difficult to follow, the assembly previously known as Java 2, will now be known as Java 5.) As ever, the language extensions have been cleverly done so that the byte-codes of the Java virtual machine did not need to be changed, thus minimizing portability issues.

Very few languages achieve success on their own; their supporting infrastructure is critical to their adoption. Java's support is excellent. In this course we look at the standard edition library packages. (The Enterprise JavaBeans, Servlets and JSP and Web Services courses look at some of the provisions of the enterprise edition library packages and APIs.)

Audience

These are not first programming courses, nor are they first Java courses.

The course will be of interest to those who already know the basics of Java programming, but who want to deepen and complete their knowledge the Java language and the main supporting library packages. The course would also be suitable for those who wish to gain familiarity with the enhancements brought by Java 5.

Duration and Construction

The course comprises two, two-day components which can be taken together or separately. If they are taken separately, it is preferable that the programming component be taken first. Each day typically lasts from 0900 to 1630, and the material is delivered via a cycle of theory-language-practice-review.

Start, end and break times can be tailored to suit individual sites.

Delivery

Courses are normally delivered at the customer site.

The course deliverables comprise:

  • lectures and a copies of the lecture notes,
  • exercises and sample solutions,
  • help with, and feedback on, the exercises,
  • leading and moderating of discussion, questions and answers,
  • reference and resource lists.

Platform

The course is normally delivered using the PC/Windows platform, using the Eclipse or JBuilder development environments. The course can also be delivered via other IDEs by prior arrangement. However, the course does not aim to teach the use of the development environment beyond a bare minimum, so to get the most from the course, it is preferable that participants have looked at the development environment beforehand.

The course requires that the standard and enterprise elements of Java 5 be installed as well as the development environment. If the machines have fast internet connections it is possible that this can be done at the course start.

Content

Module 1: Java language

Generics, collections and the "foreach"

Any opportunity to reduce the times when casting and its associated checks are necessary, is to be welcomed. Generics give us static (compile-time) polymorphism to complement the regular run-time polymorphism of object-orientation. This is at its most obviously useful in allowing us to have typed collections rather than all collections being effectively untyped and requiring frequent casting. Java's for statement has been enhanced to make it easier to iterate of collections.

Auto-boxing and auto-unboxing

As of Java 5, these give us the facility to put primitive types into collections in a fairly easy and automatic way.

Exceptions

Participants will already be familiar with try/catch. Here we ensure that throwing, rethrowing, throw specifications and finally clauses are understood; and we review the structure and contents of the exception class hierarchy. We also look at when to throw and when to consider an alternative.

Threads

We look at the benefits introduced by threads compared with processes. We look at how threads work. We also look at the problem that multi-threading introduces—interference; its solution—locking and synchronization; the problem that that introduces—deadlock, and the strategies for avoiding deadlock.

We introduce the new concurrency library support package, whose detail is covered in the next module.

Inner classes

With four different kinds of nested and inner classes, we look carefully to ensure that the deployment and purpose of each kind is thoroughly understood.

Enumerations and static import

Long missed from Java were enumerations. They have been added in Java 5. In order to give Java enumerations without changing the byte-codes, they have one or two peculiarities that we consider.

Static import allows us to remove a little of the clutter in Java: we can say, for example, sin(theta) rather than having to say Math.sin(theta).

Classes and class literals

Java sits between Smalltalk where classes are really just object instances, and C++ where classes don't have much of a run-time presence at all. We look at what Java class objects can do for us and why it's convenient to be able to refer to them literally, something which we have been able to do since 1.2.

Variable-length argument lists and printf

Yes, the answer to the commonest question from those transitioning from C or C++, is that finally Java has a printf function; and it has the variable-length argument lists necessary to support it.

Annotations

Yet another of Java 5's enhancements is a consistent way for a program to provide metadata for programmers, compilers or tools.

Module 2: Library packages

The Collections Framework

Participants will probably already be familiar with collections classes like Vector. Here though we go into more detail on how the collections framework has been designed, how the original Vector class now fits in, how the various kinds of collection work and the trade-offs amongst them. Iterators and the methods of the utility class, Collections, are covered.

Streams

For many years, in many technologies, the idea of a stream to generalize input-output or producer-consumer problems has proved its worth. When a stream is a Java object they become even more powerful. Understanding streams is crucial to correct Java deployment and we look at the various steam objects and mechanisms in some detail. We also look, since it's in the same package, at tokenization.

Serialization

Following on our work with streams, we see how to use streams to serialize objects. Serialized objects can be transmitted and can be stored; so serialization is an important constituent of distributed systems and lightweight object persistence schemes.

Weak references

The normal reference, which is built into the language, is usually referred to as just a reference. In comparison with some other kinds of references, provided by the library, we could term the usual reference a "strong reference". We look at how the three kinds of weak reference are used, and at why they are provided.

Relational Database Connectivity

Although object persistence and "object bases" may turn out to be the way of the future, we will want to connect to relational database for many years to come. We do this through SQL and JDBC. Provided the platform has a familiar RDBMS and JDBC/ODBC, we will also do some practice.

Native Methods

Java cannot connect to chips and IO registers. Java doesn't pretend to be the fastest of all languages either. There will occasionally be a need to implement some Java methods in a language other than Java. Here, provided the platform has a C/C++ compiler we will practise implementing Java methods in C through the Java Native Interface (JNI).

Reflection

Tool builders need to discover, programatically, the details of classes and methods at run-time. The reflection package support this. We survey the support provided.

Networking

Given Java's origins, one would expect strong support for networking. Java's support for networking is excellent, and network programming is pleasantly easy. We look at the interfaces and classes that support this, and provided the platforms have some networking capability, we practise as well.

The text package

The contents of the java.text package allow us to format number presentations with more control. We are also led to examine locales, dates and times.

Regular expression processing

Strings can process regular expressions (the language of searching, of sed, awk, grep and Perl, for example). There is also dedicated support in a library package.

The Event Model and AWT

We look at the event model that Java has used since 1.1. We illustrate the event model via and introduction to the way in which Abstract Windowing Toolkit (AWT) works and we survey what AWT provided. (GUI development is another issue, however, and is not covered in this course.)

Contacting

Please contact John Deacon by telephone on +44 20 7498 3773; by fax on +44 20 7498 3747; by emailing  jdeacon@jdl.co.uk; or by visiting http://www.jdl.co.uk

Home page | Courses List ]

Last modified: Monday, 22-Nov-2010.
Copyright © 2010 John Deacon. All rights reserved.

 

 

JDL Logo

Copyright © 2010 John Deacon. All rights reserved.