Vous êtes ici

A small application to help studying vocabulary lessons - the code

This article is the third one, in a series of several ones (Smile). The previous article is here.

Now, that's time to look at the source code. In version 0.1 of our application, we have five source files:

  • Review.java - that's the main file
  • ManagePairsDialog.java - this class implements management of words pairs
  • DataAccess.java - all methods used to access data stored in the database
  • PairInfo.java - this class defines words pair structure, and associated methods
  • ErrorInfo.java - this class provides a way to exchange detailed error information

The most interesting source file is ManagePairsDialog.java. That's it that defines the dialog window allowing for words pairs edition.

The code is far from being bullet-proof. For instance, it loads the whole set of pairs into memory. This is a very bad practice. But that's a very good practice to rapidly deliver a first, non-trivial version. Its limited set of functions allows for near-exhaustive debugging, thus giving way to a solid basis for following versions. And you have something to show to the targeted user, thus getting the ability to check whether your assumptions about User Interface were correct.

You can download v0.1 of source code by clicking here.

Version 0.2 adds the last function that was required to really have a working application. A new source file, ReviewLanguageXDialog.java, implements the windows that allows the user to display words to be reviewed. Each word is randomly selected from the list of words already declared.

The user can choose which kind of reviewing work he wants to perform: either from language A to language B or from language B to language A. Depending on the case, the displayed word is in language A or in language B.

You can download v0.2 of source code by clicking here.

This code uses the standard SWT MessageBox, to display warning or error messages. This works perfectly well from inside Eclipse. But no more works when run from Java Web Start environment (see next article). Consequently, in code version v0.4, MessageBox is replaced by MyMessageBox, derived from Dialog.

Version v0.5 uses Browser widget to display help information.

Next article: web start.