me)
Here are the source files, to compile with
Java 2 (aka 1.2) (we make use of the collection classes).
Plus a couple of classes we didn't want to discuss in the chapter but which
are necessary to make the thing work:
To compile and run, you'll need to do something like "javac Login.java"
followed by "java Login".
Possible points for discussion/further work:
- At present there is only a simple text-based interface. Design a
graphical interface. Can you restructure the system so that either
interface can be used, depending on the user's requirements?
- Consider the various ways of implementing collections in Java and
discuss the choices here.
- Various classes (Registry and HonoursCourse for example) have data
members which are collections, but the code does not state that it is to be
a collection of Modules rather than of Bananas. Consider the implications
of this, the connection with parameterised classes (Chapter 6) and possibly
GJ.
- Have a look at the code duplication in Login.java, and suggest how to
refactor to make maintenance easier.
- Have a look at the implementation of equals in Module.java. Why is it
there at all? How should it be future-proofed?
- How would you put something like this on the Web? Make the necessary
changes.
- The application is unfinished in that objects are not persistent, so
registrations you may make are only usable by you; and only one person may
use the system at a time. The current model is that one copy of the system
runs all the time, say in the UTO, and a succession of people use it. This
is most unsatisfactory: fix it by (a) adding some form of persistence (b)
considering the thread-safety issues.
- Related question: what are the security/confidentiality requirements?
- At present all the methods that interact are declared as possibly
throwing java.io.IOException. This is far from satisfactory (why?) Consider
some alternatives, and implement one.
- There are probably still lots of bugs... please send fixes :-)