Adobe Air billing application catharsis

Billing time to clients is something every agency has to deal on a regular basis. I find the process tedious and susceptible to forgetfulness but it has to be done. At Torchbox our minimum billable time is 15 minutes which can fly by if you’re flowing on something, or a group of related somethings, which perhaps affect several clients. It can be several hours before you raise your head and realise you haven’t billed a single minute, nor can truly account for which of those multiples of 15 can really be attributed to which client. I’ve written a little bit of software for Torchbox to help monitor this, which I thought deserved a brief blog entry.

This little app is written in javascript and HTML only, using Air as the runtime/deployment framework. I chose Adobe Air because i’m not a snob. Yeah! Boom! Take that! But seriously, Adobe Air gets a lot of negative rap and undeservingly so. Its one of a number of tools that can be used to create desktop application from web languages, along with Zinc, Appcelerator, PhoneGap and more and yes of course it has its faults. Personally my no.1 gripe is the lack of global hotkeys, but there are many more failings i’m sure, memory hunger is one I often see cited. Anyway, my point is I just don’t care. Everyone used Myspace and it was complete crap. Everyone uses Windows while complaining about it bitterly.

I’ve come to realise that choosing the right tools for the job isn’t just about careful analysis, but also about ignoring purists. Everyone has an opinion and everyone is a critic. Of couse PHP isn’t the best language but no one asked you for your fucking opinion! Here’s an idea: if you can find faults in every language, keep them to yourself. So we don’t agree with you - fair enough, its not our place to comment. By that same token it really isn’t pleasant to see someone’s entire career path belittled and reduced to series of implications that their chosen speciality is somehow a wasted life! We may not have grounds to comment, but we can’t un-read your blog post, pal.

Cough sorry about that. Where was I? Yes everyone is a critic. If you’ve done your due diligence, its sometimes best to just go with what works. Adobe Air is that path on this occasion. It works great in Windows and OSX (my app takes roughly the memory of a single Chrome window). It doesn’t work at all on Linux. Adobe air is currently on v.3.1 but Adobe dropped support for Linux at 2.7 There again if you’re willing to use Linux you’re used to things the rest of the world take for granted not being supported and you won’t lose any sleep.

The app itself is pretty much all you see in the screenshot above. You start it up, hit Space and a stopwatch starts. Edit the name of the task. Hit Space again and a new task is started and the old one stopped. The app periodically syncs with our in-office Django app which actually invoices clients for the time. To bill more time to an existing task, click it in the list. Its dead simple. I’m not blogging about this because I think I’m a genius, quite the opposite.

As the app is essentially a web page i’m also using LESSCSS to create the CSS involved. It feels pleasantly obtuse to use LESS’s client-side JS library to do the CSS parsing on the fly, not even compiled as you might for a webpage. The fact that the app is run locally means the latency of LESS downloading and running is nil, although I expect it might be fractionally quicker if I did compile it. Being able to write in purely LESS and not having to compile it (although I could use Sublime Text’s Build Systems to do that) nor even checking that a background LESS compiler had worked is pleasantly streamlined but not something you’d ever want to do on a live website.

On the CSS front, if you’ve used Adobe Air in the past but dumped it due to the lack of CSS support, give it another look. I first played with it in around 2005 and support for CSS3 was non existent. These days you can do far more, or at least enough to make your UI look pleasant without a billion background images. The interface in the screenshot above is entirely CSS3 with the exception of the “Sync” icon overlaying one of the task clocks.

I like writing apps in Javascript (fuck you i’ll use what tools I want). This one uses two core classes, the Task class - a js object representing a task - and the App class, one representing how the application itself behaves. The latter is rather generalised. I’d like to abstract it into Application, Windows and Views but theres no real incentive to do so. The lack of incentive is another benefit of the Fuck You approach to programming - you get to learn something through organically finding a need to do it, but you’re quite happy (literally, you find happiness) in not relentlessly Doing The Right Thing like Mark in Peep Show.

Its also my first attempt at loose coupling too. I decided to use a jquery pubsub snippet I found to help out although I suspect I should probably be using Air’s internal EventListener framework. Its nice to be able to yell events into the ether from one class, for them to be magically plucked out the air by another without any nasty passing of large objects around. I’ve swapped a few of my jQuery pubsub functions for Air Events-related ones with absolutely no change to the app’s memory/cpu footprint, so using Air’s Event framework is really just a matter of purity.

On a purely aesthetic note is nice to be able to put time and effort into writing someone complex that no one asked for. I’ve been in a support role for 10 years and found it vital to my mental stability that I find the time to work on something else that isn’t questioned or criticised. Something you can see through right from the start on completely your own terms to no deadline, specification or prerequisites. Finding a completely unfulfilled need and addressing it is hugely rewarding.

Its also nice to work on something that feels like a program. The ability to release completely encapsulated code in (what is essentially) .exe format is pleasantly final, satisfying even daring. Traditional web development has similar principals, perhaps a Fabric script or Heroku like deployment framework, or just a Git command, but its not quite the same. Writing something you can legitimately label “For Windows/Mac” feels like you’re joining a more mature culture, something intrinsically more respected and that you’re on the cusp of turning a profit, even if - as in this case - you’re boshing together an internal app in an immature language with no possibility of resale!