My Movies 1.0.0

My Movies 1.0.0

My Movies - A Simple Java Swing Application

See:
          Description

Packages
hirondelle.movies Launch point of the application.
hirondelle.movies.about Show a simple 'About' box, displaying information about the application.
hirondelle.movies.edit Edit movies.
hirondelle.movies.exception Classes related to exceptions.
hirondelle.movies.exit Close the application and exit the JVM.
hirondelle.movies.login Log into the application.
hirondelle.movies.main Main window in the application.
hirondelle.movies.util Simple utility classes.
hirondelle.movies.util.ui Utilities for Swing user interfaces.

 

My Movies - A Simple Java Swing Application

Points to Note

JDK 1.5 is used
No tools or jars other than the JDK are used.

This javadoc links to the source code
The javadoc tool has -linksource option which implements this. The links are under class and method names.

No Unit Tests Included
There are no JUnit tests included. However, many applications would benefit from using JUnit test classes - especially for the Model Objects (eg Movie).

Don't use extends unless you have to
A dialog does not have to extend JDialog. Instead, you can almost always use a JDialog as a field, not as a superclass. The reasons for doing so include :

If desired, a getDialog() method can always be added to allow the caller access to the underlying dialog object. This technique is used by the StandardDialog class.

Default scope
The default scope for classes is package-private. Scope is increased to public only when needed.

Final is preferred
Classes that aren't designed explicitly for overriding (the great majority of classes) are declared final.

Dialog policies are centralized
The StandardDialog class centralizes a number of policies for dialogs. This both reduces code repetition, and helps give your app a uniform look. The StandardDialog class is an example of the Template Method design pattern.

Package-by-Feature is used
All items related to a single feature are placed in single directory/package devoted exclusively to that feature.

Custom Exception Handler
The ExceptionHandler class customizes how Java behaves when a RuntimeException occurs.

Invalid User Input
When user input is found to be invalid, a checked exception named InvalidInputException is thrown by a Model Object constructor (for example, see Movie).

Logging
This app uses JDK Logging. The app logs to a file in the application's home directory. The logging is set up in LaunchApplication.

Font
The app uses a custom font for all components.

Relations between classes in the same feature
This app shows two styles for "wiring" classes together.

In the Login feature, the Controller comes first:

LaunchApplication
  -> LoginController 
    -> LoginView (dialog)

In the case of the Edit Movie feature, the Controller is called later:

MainWindow
  -> MovieActionAdd (simple Swing Action)
    -> MovieView (dialog)
      -> MovieController
        -> Movie (model) 
        -> MovieDAO (data access)

Coding Conventions

Short Methods
Most methods are quite short. This significantly improves maintainability. Even one-line methods are used, whereever it increases clarity for the maintainer.

Table Sorting
The MainWindow contains a table. Clicking on a table column header resorts the table, ascending and descending.


My Movies 1.0.0

Copyright Hirondelle Systems - Generated 2008Dec30.15.53