Sunday, 24 January 2010

Relationships, testing and non project problems

Relationships

So far this week I've looked into issues with relationships between races and swimmers. In order to represent this correctly I've created a raceRecord which belongs to race and also to a swimmer. I struggled with how to do this but I found the answer in Grails In Action (page 87 in case you're curious). Simply:

static belongsTo = [Race, Swimmer]

When the controllers and views are generated all seems to be as it needs to be.

Testing

Ok so I want to believe in the whole Test Driven Development (TDD) ideal but Grails just seems to be so easy to whip stuff up and tests are just not sexy to write. However I've promised myself that I'm going to do things right. I spent some time writing a couple of basic tests for the constraints on the domain classes. It was here that I added a grails plug in (the code coverage plugin). This allows me to run test-app -coverage to see stats on the amount of test coverage I have which I find pretty motivating. Now time for a little rant...

I know that test coverage in and of itself is not a concrete guarantee of code perfection but its got to be better than not testing at all. Yes the quality of the tests is fundamentally important but its not enough to say that just because tests can be poorly written so why even bother having them. Surely this goes to your own integrity to make sure your code (and your tests) does what its supposed to do. If it sounds like I'm excited, let's just say that this has been a bone of contention in my day job recently. Anyway the swim project will not progress any further until all domain classes have tests for constraints to start with. I've updated to the new Grails Textmate bundle too so this should make my test writing quicker.

OS and other disasters

I'd previously partitioned my MacBook hard drive to allow me to install Windows 7. After a couple of days I ditched it for Ubuntu and had been happy with that but with no time for OS experimentation decided to reclaim the partition for OS X. However I couldn't simply re attach the rogue partition and had to wipe and reinstall everything. I do have an external hard drive but its partition as FAT32 and therefore cannot be used by OS X's Time Machine. Therefore I had to manually copy my files over and then copy them back. This was a significant time cost and I think with such cheap hard drives I think I'll get another for Time Machine to avoid this drama next time. The whole process was made easy with MacPorts though.

In better news, I've started following this great blog from a mate of mine about his quest to build a python driven robot. Its well worth the read.

Sunday, 17 January 2010

SwimClub: Steps 1 and 2

The swim project is to create a web app to host the swim club results. My weapons of choice are:
Framework - Grails (1.2)
Versioning - Git
Server - Tomcat
IDE - Netbeans although to date I've only needed Textmate

My first goal was to create a skeleton and then find something to host the site so that my mate (client) can check it out and provide feedback as we go. I've got an idea of where I'm going with the app but its really going to be quite fluid as I receive feedback. As mentioned in an earlier post we're trying to flesh out functionality here and will worry about the look and feel later.

Basic Structure

In order to think the structure through I've decided to create a bunch of basic domain classes. So far I've got a Meet which has many Races. These in turn have many RaceRecords. A RaceRecord has a Swimmer and a time. Eventually I'll refactor the Swimmer class so that it inherits from a User class as there will be other types of users not just the actual swimmers. Using scaffolding I've got basic CRUD operations for each of these domain classes. So far so good..

Hosting

Although this is just under development I still need to be able to host the app so that I can receive feedback as we go. I've decided to just host it locally and use DYNDNS to manage the dynamic IP. I followed the excellent instructions here to install Tomcat. No real issues so far. My only concern is stress on my old PowerPC iMac as its used by the family in addition to the hosting. It has only 1.5 GB Ram and I've created a completely new user for the test server to keep it all separate. Previously I've used Glassfish but that seems a little like overkill at this point, maybe later when I need something that's production worthy.

With all this done things are progressing nicely. Now I'm just waiting on some answers to questions for some fundamentals before progressing. BTW using Google Wave for this as it project work seems to be the only thing its good for. If you're keen let me know and I'll add you to the wave.

Wednesday, 13 January 2010

Rant: The 4 Programmers You Meet In Heaven

Recently I finished reading Mitch Albom's The Five People You Meet In Heaven, a wonderful thought provoking book. It got me thinking about the people that have influenced my own life and more specifically those that have influenced my programming career. Now rather than embarrass these people by naming names I decided to rant about the types of people you meet in your programming journey.

The Kung Fu Zealots


These people I first encountered at Uni but I've meet a few since. They're passionate about their craft to the point that their ideas and way is better than anyone else's. It reminds me of the old time kung fu movies where rival schools battle it out because their way is the only true way. Their programming skills are an essential part of their identity so a criticism of their language/framework/way is a slur on them.
The reason these people make it to programming heaven is that they are so enthusiastic about their language and so can learn heaps from them. If only they could open their minds to other ideas...

The Soldiers


I am lucky enough to work with a couple of these guys. They're the ones who don't make a fuss, don't see what the big deal is, they just get stuff done. Programming might just be their job and perhaps they really enjoy it but they've got more going on in their life. Unlikely to ever been seen in a meeting, they're just about getting the result.
The reason they'll make it to programming heaven is their no muss no fuss attitude. Its not about ego its just about results. Much can be learned from the soldiers.

The Rock Stars


Few people fit into this category but fortunately I've met one. Brimming with energy for the programming craft regardless of style, their enthusiasm is infectious. Sure they may have a specific speciality but they're open to new ideas and new thinking. They're keen to hear about what you're into, how you do stuff and don't judge, only encourage.
Pretty obvious why these people make it to programming nirvana.

The non programming programmers


Ok I know it sounds weird but these are the people that just inspire you to learn more. Practical, hands on, these people could be rock stars if they'd gone down the programming track. They could be from any industry but its not their occupation that's important but they're attitude to learning. They just can't get enough knowledge.
These people make it due to the fact that their eagerness to think something through and understand the how and why of anything also inspires.

So that's my take so far. I hate to violate the DRY principle but all of these types of people have been inspirational to me. No doubt others have had different experiences and I know people shouldn't be put in boxes. Hopefully you've got sources of inspiration in your life too.

Tuesday, 5 January 2010

New year .. new project

So its the New Year, a time when I usually make a resolution to lose weight and then after a couple of weeks its back to business as usual. This year I thought I'd like to bypass the diet resolve and make myself more accountable by blogging more. There probably aren't that many readers to this blog but the act of documenting the week to week progress of a project helps to keep me motivated.

Now what will I be blogging about? Well I've got a bit of a personal policy that I won't blog about my work at all however I'll keep all posts technical or IT related. I'm going to detail the whole start to (hopefully) finish of my next project - a record keeping system for a swim club. In addition to this I'll throw in the occasional rant just to keep it interesting.

The Problem


My mate is a swimming coach and he needs to be able to record times from meets and competitions. Sure he could use a spreadsheet but ideally he wants to link the data to a site that swimmers can access and track their own progress. Cost is an issue too so the hosting solution needs to be cheap (Google App Engine did you say?) I've looked a this problem before and time became an issue. Following the squash ladder project I think I've learned some more tricks so hopefully my productivity will be much improved.

More to follow soon...

Sunday, 1 November 2009

Enter the Koala

I've been wanting to get away from Apple for a while. Now don't get me wrong I think their stuff is super cool but the idea of complete freedom really appeals. I've a household that has 2 iMacs, an old powerbook and a macbook. So the quest for freedom means Linux and I've chosen Ubuntu for no reason in particular. My personal machine is used for development stuff (Netbeans, Eclipse, Textmate) and the usual web surfing stuff. I also keep my music on this machine and sync it to my iPhone.
Now I tried to switch away to Interpid Ibex but found a number of problems:
  1. My Microshaft Bluetooth Mouse wouldn't pair
  2. Sound quality was dodgy
  3. Couldn't drive my external 24 inch monitor (deal breaker)
After getting annoyed with some Snow Leopard problems (trouble loading images from sites in 10.6 but these work fine in 10.5), I decided to try again with the latest Ubuntu, Karmic Koala.

My initial findings were really positive, the install process was easy as always, and relatively quick even compared to Snow Leopard. The bluetooth mouse paired without incident and I was really impressed with the look and feel. The number of free software packages is outstanding and really I haven't been able to find anything that I'm missing.

However, my poor old Macbook (mid 2007 model) can't push the pixels required for the external monitor even when turning off the native display. This is a blocker for me as I need the extra screen real estate with my failing eyesight. Another small issue is that while sound plays out of the inbuilt speakers, it wouldn't play from a headphones or line out to external speakers. I'm sure with a little digging I could find a solution for that but without the graphical power to use my extra monitor I'm going to have to go back to Apple.

This being said I feel that Karmic Koala is totally awesome and I'd happily move to it if my hardware would do the job. Given PC prices are cheap in Oz at the moment, I might consider getting a box and using that as my main machine. (PS I blogged this from Karmic and felt totally free while doing it).

Sunday, 11 October 2009

Cool Podcasts

I haven't fallen off the blogging planet just been busy enjoying life. Family's great, friends' great, work's great (although challenging). So I've been looking for some more cool podcasts to listen to while commuting to work or performing repetitious tasks. I find I can't listen to stuff while concentrating but if something is a little monotonous I enjoy a good podcast (when not listening to classic hair metal!). Here are some of my favourite podcasts:
  • the Grails Podcast - my favourite all time podcast. Glen and Sven bring cool Groovy and Grails news whilst at the same time remaining positive and funny. I would listen to this even if I wasn't into Grails.
  • Software Engineering Podcast - this is a somewhat more sombre podcast but very educational. This is not so much a news podcast as teaching podcast.
  • Hak5 - This is a vidcast and covers a bunch of different stuff. Its got a little bit of product promotion and sponsorhip recognition but nothing that seems to compromise its integrity. Also really entertaining with a great vibe between the presenters.
  • Elegant Code Cast - I wasn't sure about this one. Its not java orientated and I have zeroo .net and c# experience but interestingly they cover some good topics. I've only listened to a couple of these but I'm going to stay on it for a bit longer.
  • Network Security Podcast - Stock standard security podcast (and I've listened to a few) and pretty informative. I like this more than Security Now (too much advertising in that one).
I look for casts that are interesting, short (ideally 30-40 mins) and entertaining. Got any suggestions? Let me know!

Saturday, 11 July 2009

When does it end?

So its been awhile since I last blogged. Things have been going swimmingly with the squashLadder with basic functionality built and I find myself questioning when I should call it finished. I have a number of other ideas for interesting projects so when do I walk away from this one? I find these phases of a project difficult to get past. The app is pretty much at a 1.0 stage and is usable, indeed is being used to record our work squash games so is it time to move on?

Normally I could seek counsel and direction from the great Grails sage but alas he's on sabbatical. Therefore prior to sitting at the keyboard tonight, I tried to channel the Kenobi like advice that I thought he may have provided and this is what I came up with.

The original purpose of the app was just to learn not necessarily to build a plain old app. Rather than just being satisfied with the mediocre app, I should push the boundaries and do the extra stuff that make the learning worthwhile. Here's a list of stuff that would be cool:
  • add line chart to front page showing win percentage trends for each player
  • add some sort of cool fade in transition on the stats page to cycle between a players matches & wins / trending vs players and form-o-meter
  • remember me functionality
  • ability to add groups of games (via checkboxes) rather than having to individually enter each game.
I guess building another app would reinforce some of the things that I've learned so far but the ladder has been such a great vehicle for learning that I should continue with it.

If you've got suggestions for features that you think would be cool, please let me know.