Because sharing is caring

SCJD URLyBird v1.1.1 Assignment: first notes

Posted: August 4th, 2010 | Author: | Filed under: Java, SCJD | Tags: , , , | 1 Comment »

After successfully completing my SCJP certification (score of 81% thank you very much), it’s time to start my SCJD certification.

This certificate is achieved in two parts:

  • An assignment which requires you to develop an application
  • An essay you must write to prove you were the one who developed the application and not your supersmart neighbour

I recieved my assignment this week and was surprised to find how little descriptive it was. I was expecting at least 5 use-cases, a GUI design, 3 domain classes that are interlinked and connection to an Oracle database or something.
What I received however was a 6 page HTML  file that describes about what it should do, an interface you must implement and a .db file with serialized data.

Today I dove into reading that file extensively. The only thing I can say is: there isn’t one word too much or too little on that page.
I spent about an hour reading, underlining and taking notes and I recommend you to do the same if you’re going to take your SCJD.

Also, I found this great class written by Roberto Perillo that will surely help you along if you’re having trouble figuring out your database structure.

Development Notes

These are the notes I took on my first read.
I will most likely append to these notes as I develop the application along the way as this will server as my checklist for development.

Structure

The application consists of 3 parts as I see it:

  • Client application
  • Server application
  • Database layer

The data is always retrieved from the database layer. However, the client application can either read and write directly to the database file, or do this via a server application
The server application must be able to allow multiple connections (hello multithreading).

User Interface

  • The user interface must be built using solely Java Swing components
  • The user interface must provide functionality to give a lists of all the bookings
  • The user interface must provide functionality to update/add bookings
  • The user interface must provide search functionality on all fields of the database
  • Results of search/booking listings must be presented in a JTable
  • Settings and preferences of the UI must be saved in a file called suncertify.properties

Database

The database is from a given file. The structure of this file must be adhered.

Structure

The structure of the .db file consists of 3 important parts:

  • Information
    • 4 bytes: Magic cookie that identifies this file as being a data file of a certain type (there are different data files for different assignments)
    • 4 bytes that tell you how long each record will be
    • 2 bytes that tell you how many fields each record
  • Structure, repeated for each field
    • 2 bytes that tell you the size of the fieldname (e.g. ’4′ for field ‘name’)
    • n bytes: field name (n being defined in the precious record)
    • 2 bytes: field length
  • Data: structure defined by previous section

The overall structure is given in the assignment, for me it was:

  • Hotel name: name(64)
  • Hotel location: location(64)
  • Room size: size(4)
  • Is it a smoking room: room(1)   (valid values: Y/N)
  • Price: rate(8)   (including currency. E.g $200.00)
  • Date of booking: date(10)  (yyyy/mm/dd)
  • Owner of the booking: owner(8)   (numeric ID for customer of null for still available)

Requirements

The database layer must provide :

  • record locking. This does not mean file locking!
  • Searching on all fields
  • Listing all records
  • Adding and updating records

Server

The server provides network access so multiple clients can work on the same database.

This server can work via Sockets or RMI. When using RMI, you must use JRMP.
I think I will use RMI as it looks like the cleanest solution.

Footnote

These are all my notes for now. I’ll worry about documentation and delivering when I acutally start developping.


One Comment on “SCJD URLyBird v1.1.1 Assignment: first notes”

  1. 1 Leo said at 1:37 pm on June 15th, 2011:

    Hello Bart,

    Nice notes.
    Thanks for sharing.


Leave a Reply