Saturday, April 2, 2011

A06. Persistency

I finally had a chance to finish the integration of Wicket, Berkeley DB, and Restlet. For this assignment, we were tasked with the following two items:

  • Create a secondary index on the timestamp field
  • Provide a web page that will allow the user to get and store data

Some background:
This is a database of contacts, which includes the following fields:

  1. Unique identifier (user-entered)
  2. Name (first, last)
  3. Information (text field)

My understanding of REST, two months later:
When REST was first introduced to us, along with the MVC (model view controller) architecture, I didn't really understand how prevalent both of these ideas were out in the wild. But now that I'm interning at a web development company, and learning Ruby on Rails, it's become apparent that there's no avoiding either of these ideas.

At my internship, we have interface designers and web developers. And I can fully appreciate the MVC model for web development, because it allows the developers to worry ONLY about scripting and writing code to get the inputs and outputs to work, while the designers can focus on making the website pretty. It's a really nice way to separate effort, where doing something on one end has minimal if any impact on the other end.

REST, on the other hand, keeps popping up. Rails supposedly is a RESTful architecture. There are usually no absolute URI's defined, and URI's are created on the fly for the most part, depending on what resource or object from the database that you want to view. I'm still a little fuzzy on how machines talk to other machines via REST, but the entire concept of representations and XML really helped me understand things better when I started my internship. Everything it seems has an XML style hierarchy structure when sending information back and forth between systems.

Kata 1: Create a Secondary Key called Timestamp
This was relatively easy, since I already had experience doing this for the Solar Decathlon project I had been working on, which incorporates a BerkeleyDB backend with a Wicket frontend and Restlet simulator. I happened to work on the BerkeleyDB portion of the project for the first project milestone, so this wasn't a stretch at all.

Duration: 1 hr

Kata 2: Creating a Form Page using Restlet, Wicket, and BerkeleyDB
This was a little more difficult, because it had been so long since I worked on Restlet. So I had to re-watch some of the screencasts by my Software Engineering professor. I also had to go and review some of the Restlet code I had written before to re-acquaint myself with things.

Once I had completed the exercise (screenshots are shown below), I wanted to make sure that I could build two .jar files (one for the contact server and one for the webpage interface client) via Ant. This actually almost took as long as the exercise itself, due to some directory renaming issues.

Duration: 3 hrs + 2hrs to get both the client and server .jar files to work and build via Ant

Screen Shots of the finished Kata:

Screenshot 1: Storing a Contact into the Database
Screenshot 2: The confirmation that the contact has been added
Screenshot 3: Retrieving a record via its unique ID

Download the Eclipse Project: HERE