The Dating Game

Working with legacy code can present some, um, interesting challenges. I just hit a wonderful issue to do with dates and timezones, caused by a really piss-poor data model.

The code I was looking at was comparing two maps, both keyed by date. The problem was that the system was never designed for international use, so while one map (the one coming in from the UI) was correctly mapped to the right time zone, the other (from the server) wasn’t. So, naturally, the code didn’t think that the two collections had anything in common. Ouch.

What makes it really bad is that, apparently, the data model (part of the legacy, and not amenable to change at the moment) understands about time zones. That is, it “understands” that each country has one. And only one. Considering that just in Australia, we have three (four if you include the Daylight Savings Time split), this isn’t really understandable at all.

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: