Monday 23 February 2009

It's unique, just like all the others

So, I've been going to a few job interviews lately and I can honestly say that no two have been quite the same.

For the first few weeks after arriving in London, I was applying for contracting roles. It didn't take me long to realise that Spring and Hibernate are a big deal in the local job market, so I started to do a bit of upskilling - Winning 4 days worth of training in the latest Spring technologies was a good start, but the timing of the course - December - was awkward as I had to second guess how that might be treated by a prospective employer - Good: training; - Bad - 4 days off before he's even started really working.

Reading the books and having a course coming up was never going to be enough to get me up to the standard expected when a company is paying top £s for a specialist, so I eventually agreed to look at permanent roles.

The first interview was in Devon and involved a long train journey - which half convinced me that it was not going to be suitable, given that at least some of the reason for my moving to the UK was to be close to Ireland and Europe for quick weekend getaways. After I had proven my technical prowess in a coding exercise and a general "problem solving around the whiteboard" discussion, I had the panel interview with 2 techos and an HR person. I decided not to proceed with the team lead role they were looking to fill as they were also looking to change their entire development methodology - and I could see that being painful.

The next interview was for a role as a consultant and was run in a cafeteria with a couple of techos, that would have involved me working at client sites and from home - which doesn't really fit with my preference to stick with developing as part of an agile team.

The third interview was unusual in that the company involved approached me directly after finding my CV online - as opposed to the agencies that I usually hear from. Their offices seemed nice, and the discussion went well - but I wasn't really expecting to hear back from them, given the timing and the industry sector they are in.

The fourth interview involved another out of town train ride, but ended promisingly with the guy saying HR should be in touch with me with an offer - hopefully before Christmas. So, leading up to Christmas I felt that my quest was at an end, but the holy grail of a steady income with that company ran away in corporate re-structuring and an unrelated subsequent recruitment freeze.

January proved to be quite a quiet month on the recruitment front, so I applied directly with a few companies and followed up on some companies that I had been in touch with pre-Christmas.

In two interviews I foolishly attempted to bluff my way through describing the design of a system that I had been responsible for developing. I kept tripping over how to describe a particular sub-system which a colleague had designed, but which was critical to the description of the product.

The feedback was mixed:
- one company said I was technically great, but recommended that I read a particular couple of books (one of which I had already read, the other I am in the process of reading right now);
- the other company told the agent that I gave the impression that I wasn't interested in working there

Given that I had just spoken to the agent to let them know that I would lower my salary expectations by 10%, as I felt that the company had a great approach and were really innovative in applying agile methodologies to their development, getting that kind of feedback came as a bit of a shock to me.

So, in the next interview I made a point of giving well thought out responses to the touchy feely HR questions as well as the technical ones. I thought that I was on a roll when the interviewer said that a lot of candidates hadn't known some of the aspects that I had covered... The interviewer deliberately skipped his questions about Hibernate, as I had stated on my applciation that I did not have commercial experience with it. So, I think that I was justified in feeling frustrated upon hearing their excuse for not proceeding further with me: the other candidates they spoke to had more experience with Hibernate.

So, now I've finished reading Java Persistence With Hibernate and have started posting solutions to problems other people are reporting on the Hibernate forum site. I like to learn from other people's mistakes, and get a feel for what areas are proving to be challenging. It's been re-assuring to find that the issues encountered are much the same as I found with JPA - but saying that "I don't have experience with Hibernate, but I've got a year of JPA and 3 years of JDO" doesn't mean much to the recruiters.

Now that I have some casual part time work I should be able to fill a few of those silly gaps in the CV and be set to hit the ground running - maybe I could give contracting another look?

Friday 20 February 2009


I've been keeping an eye on JavaFX since I first heard about its impending public release in December 2008. At the time I was looking into developing rich UI applications within the browser - as Flex seemed to be taking off, but I didn't want to have to fork out money or jump through hoops to get a decent development environment set up.

Today I watched a video over at the website that introduced some of the features of the JavaFX language. Some aspects of it reminded me of my first formal education in computer science - COSC 121 at the University of Canterbury in Christchurch, New Zealand way back in 1995. We were taught about Modula-2, which is a procedural programming language similar to Pascal.

I'm a little curious to know why the implementers of the language chose to have parameter type and return type information specified after the variable name and parameter list respectively - like Modula-2 and co. - as opposed to having it prior to the variable name or function name, like Java and the C family of languages.


function area(radius : Number) : Number
return PI * (radius * radius);

compared to:

double area(double radius)
return PI * (radius * radius);

I'm not going to lose sleep over it, and can't look for more info at the moment as the Sun sites are experiencing some scheduled maintenance downtime.

The way that programmers can choose the size of increments in an expression also reminded me of Modula-2:

java.lang.System.out.println ([1..10 step 2]);

seems like one of Modula-2's looping mechanisms:

FOR Index := 5 TO 25 BY 4 DO

Tuesday 17 February 2009

Reporting Potholes

I've noticed on the news here in the UK lately that potholes in roads will have expanded due to the recent cold weather conditions - the old "freeze-thaw" effect.

In some areas people are being encouraged to report potholes to their local council offices - which got me to thinking, how about setting up a website linked to Google maps to allow members of the public to locate potholes in their neighbourhood?

A quick Google search suggests that I'm not the first to think of applying technology to achieve something like this, in no particular order:
Then I came across something that looks like it already does the job:

Friday 13 February 2009

Implementation of the Singleton pattern

The last successful job interview that I had included a minor practical pen and paper exercise - "Show me how you would implement a Singleton in Java".

I'd been using the Singleton pattern for about 6 years by this stage, so I just jotted down the most basic implementation that I knew, something along the lines of:

public class Singleton
private static Singleton instance = new Singleton();

private Singleton()

public static Singleton getInstance()
return instance;

As I was doing this I thought of all the fancy examples I had seen in various projects that I have worked on and code snippets from various books that I had been reading at the time. So I did my typical self-deprecating thing of saying out loud, "I should probably have some lazy instantiation happening in the getInstance, but that could just be premature optimization".

That lead into a discussion with the interviewer who congratulated me on being one of the few candidates who had actually produced a truly threadsafe implementation. If I had delayed the instantiation until the getInstance was called, then I would have had to introduce some synchronization to prevent the possibility of the instantation happening multiple times, something along the lines of:

public final class Singleton
private static Singleton instance;

private Singleton()

* synchronized to prevent multiple instantiations of Singleton
public static synchronized Singleton getInstance()
if (instance == null)
instance = new Singleton();

return instance;

Then the overhead of the synchronization would have been introduced for each and every call to getInstance - not ideal.

Head First Design Patterns gives a good overview of a slightly better approach involving double-checked locking that I have added to my repertoire (suitable for JVMs 5 and upwards).

Tuesday 10 February 2009

Relational Databases - PostgreSQL

Is it just me, or are there a lot more free and open source database systems out there than there were 3 or 4 years ago?

I was following a thread on a Hibernate forum the other day and they mentioned a couple of options that I've used in the past - PostgreSQL and MySQL, a couple I'd heard a little about (e.g. SQLite and Firebird) as well as something called H2.

Of these options, I prefer PostgreSQL. I've been using it on and off for almost a decade, but I don't think that necessarily makes me biased as I could just as easily have been frustrated by it if it wasn't such a flexible and reliable system.

The extensive feature set really saved me some embarassment with a project that had a very tight schedule a few years back.

My team had developed some Java code based around the Geotools APIs to manipulate some GIS data in a shape file. That all appeared to be working fine - until I attempted to deploy it onto our in-house test server which was a Linux system and had the same setup as the server that we intended to host the web-based application on when it went live!

I did some digging around and established that Shapefile manipulation was just for demonstration purposes (so would not have suited our needs anyway), then found that there was also the option of accessing the data via a PostGIS data source. So, I spent my Saturday afternoon building a new PostgreSQL system from source code, with the GIS extensions and the optimal geometry packages available compiled in .... and did a bit of tweaking of the PostGIS access code in Java and had the project right back on schedule for Monday morning's, "So, what did you get up to on the weekend?" coffee break.

I subsequent got the chance to pick up the same set of technologies and have them in place from day 1 in another project, so got to spend some time looking for decent tools for visually verifying the data - uDig was the best nice free system I could find - it connects to PostGIS fairly easily and exists within an Eclipse framework.

Google Visualization

My brother was looking into setting up some charts on a website that he administers, so I offered to take a look into how involved it would be.

I was pleasantly surprised to see that what would previously have involved a lot of fiddling around with server side graphics manipulation APIs can now be achieved by using some nifty Javascript libraries.

So far I've only played around with some hard-wired fake data, so the next step is to wrap some real data in a DataTable and see whether it scales up nicely - with the usual cross browser testing.