You are here

A small application to help studying vocabulary lessons

Context and requirements

This year, my eldest son started learning spanish, at school. He is the kind of boy who does not spend a lot of time in studying his vocabulary lessons. Immediate consequence: average grades...

So, I wanted to provide him with a simple application that could help him in reviewing his vocabulary lists.

The first version of this application should include following functions:

  • handle pairs of words: (spanish word, french word) [we are french]
  • allow to add new word pairs, to edit existing ones, to delete existing ones
  • when a word in language A owns several translations in language B, one must enter one pair per translation
  • store word pairs in a persistant way (do not lose data between two application activations)
  • build and present random series of words, in either way (spanish to french, or french to spanish). Only word in language A should be displayed. The user should be able to request the display of related word(s) in language B.

Some additional, non functional requirements:

  • the application should run on Linux and on Microsoft Windows
  • that's all for now Smile

Development environment

I'll use Java language, so that Windows / Linux requirement is fulfilled. Additionally,using Java should allow for easy ports to other platforms (e.g. my Nokia N810).

I know Eclipse a little bit more than Netbeans, so I'll use Eclipse. Netbeans includes a native GUI builder. For Eclipse, I could add one, like Jigloo, for instance. But as my application is very simple, in its first version, I'll do without one.

To get a look and feel well-integrated into the execution platform, I'll use SWT.

To store data in a persistant way, I'll use Derby.

I'll store my source code into a subversion repository, on my Linux (ubuntu 9.04) PC. I'll configure it so that I can access the source code from any other machine connected to the internet.

Eclipse installation and configuration

Synaptic knows about the 3.2.2 version of Eclipse (Callisto), no more. So I manually install the latest version, Galileo, after having downloaded it from the Eclipse web site. And, before this, I install the sun-java6-jdk package.

See below for installation of subclipse plug-in.

SWT is downloaded from here. And installed according to this page.

For Derby, I install Derby plug-ins (core, ui and doc plug-ins must be extracted into the eclipse plugins directory). Derby plug-ins documentation is accessible from Eclipse help. Derby documentation is here.

Once the Derby plug-ins are installed, add Derby nature to the concerned project. The effect is to add following libraries to the project:

  • derbyclient.jar
  • derbytools.jar
  • derby.jar
  • derbynet.jar

Subversion installation and configuration

To install and configure subversion, I rely on those documentations: this one and this one. Resulting main steps are:

  • install subversion, using synaptic
  • sudo mkdir /home/svn
  • sudo mkdir /home/svn/projects
  • sudo addgroup svn --system
  • sudo adduser svn --system --home /home/svn/projects --no-create-home --ingroup svn
  • sudo svnadmin create /home/svn/projects
  • sudo chown -R svn: /home/svn
  • sudo chmod -R g+rws /home/svn
  • sudo adduser <myUsername> svn
  • check that an ssh server is installed and running

I'll use svn over ssh, to ensure that no clear-text passwords are transmitted over the internet. As the PC where I install all this stuff connects to the internet via a router, I need to configure it, adding a port forwarding rule: every incoming connection request on port 22 (ssh port) will be forwarded to this PC. While I'm at it, as I use DHCP on our home network, I add an address reservation for the PC, to ensure that port forwarding will always be OK.

To use svn from a remote machine, I'll have to use the following syntax for the repository:

  svn+ssh://<userName>@<routerDomainName>/home/svn/projects/<projectName> 

with:

  • <userName> : my Linux username
  • <routerDomainName> : the domain name of my router, as known on the internet
  • <projectName> : the project I want to work on

Ssh will request a password: I'll have to give it my Linux password.

Most of svn commands will ask twice for password. As they open two successive connections to the repository, ssh asks the password twice... To get rid of this problem, one possible solution is to configure ssh so that it uses keys. We'll do this later on...

Svn documentation is here.

To have a direct access to the svn repository from inside eclipse, I install subclipse 1.6.5. Documentation is available from the eclipse help.

Useful SVN commands, in command line mode:

  • svn list svn+ssh://<userName>@<routerDomainName>/home/svn/projects/ => returns list of my projects

Next article: design.