Fix the broken windows

Screenshot of program code

Sometimes, after finishing the implementation of a new part of a program, I like to take a break and sort of aimlessly browse the code that I’ve written so far. I will pick a module and start reading a couple of classes, and see where that takes me. It’s a form of procrastination. That’s me coming back up to the surface to breathe, to gather up my willpower before I again dive deep into another intense round of coding.

While code reading, I will often find things about the program that can be improved on. Some things will be small – add some documentation; fix typos, whitespace or indentation. Maybe pick a better name for a variable. But sometimes, I will find bigger opportunities for improvement, and I will do some ad hoc refactoring.

I believe that this is a healthy form of procrastination. It keeps my knowledge of the program domain current, and keeps the code lean, the best I can make it. This creates a virtuous cycle of implementation, polishing, implementation, polishing again and so on. I do not consider it wasted time. A codebase that is sound is easier to add to. It’s an investment towards less work in the future.

However, sometimes I have to work on a codebase that is in a bad shape. When that happens, I just want to go in, make the changes that I need to make, and get out of there without leaving too many brain cells behind. I will leave things in a better state than I found them, but I want to be out of there as soon as I’m done. I will not go out of my way to seek out things that I can improve on. Because I can already see the issues staring at me in the face, and there are so many of them. Motivation has taken a quick look and said “Look, I just remembered that there’s this thing I gotta do. Call me later, you know, after you’re done here.”

Maybe you’ve heard about the Broken Windows Theory. It goes like this:

Consider a building with a few broken windows. If the windows are not repaired, the tendency is for vandals to break a few more windows. Eventually, they may even break into the building, and if it’s unoccupied, perhaps become squatters or light fires inside.

Or consider a pavement. Some litter accumulates. Soon, more litter accumulates. Eventually, people even start leaving bags of refuse from take-out restaurants there or even break into cars.

So fix up your broken windows. Be vigilant and always worry about what you’re presenting to a visiting programmer. If it’s obvious that you don’t care about your code, then the next person to add to it will care even less. Soon badly indented code becomes poorly structured code. People start spawning state needlessly simply because they can’t be bothered trying to untangle the mess. They’re holding their breath while running through corridors that stink of urine. They just want to get in, add this thing they need to add, and run out again. One day someone trips over some wiring and the building is on fire.

Fix them broken windows.

Mainpeak wins at the Web Awards

Mainpeak Website

Two ecommerce projects in the past two years, and two national awards. As usual, it’s been a pleasure working with the team at Humaan. Congratulations guys!

Recent project: Event Weather Redesign

Event Weather Website

I recently worked with Event Weather and Daniel Brouse to launch the latest redesign of the Event Weather website. Daniel and I wrote the original site back in 2008, when we were both working at Bam Creative. This is the third iteration of the service.

New ControlMyWeight CalorieKing app

Screenshot of ControlMyWeight app

After several months of work, we have just released ControlMyWeight, our latest CalorieKing app. It is currently available on the USA and Canada app stores. Get it while it’s hot :-)

Update [14 December 2012]: The app is now also available on the Australian App Store.

Kosmic wins at the Australian Web Awards

The new Kosmic website has won the ‘Best Overall User Experience’ category at this year’s Australian Web Awards.

Congratulations to Kosmic and to the team at Humaan. It’s been great working with you guys and it’s a fantastic achievement.

Kosmic website featured on the Web Awards website

Recent Project: Kosmic Online Store

Towards the end of last year, Jay, the principal at Humaan and a good friend of mine, asked me if I was interested in collaborating with his agency on a new online store for Kosmic.

The new website went live recently. After several months of work, we were pleased with how things turned out.

Kosmic Website

The client had previously gone down the path of a bespoke system. Relations with the previous developer had soured and the client expressed a strong preference for an open source system in order to minimise vendor lock-in.

We looked at the requirements and decided to build on the Magento platform. Magento has a rich ecosystem of third party modules that we could tap into. This allowed us to reach feature parity with the old website very quickly. At launch, the new website would do much more than what the old site used to do. We were very happy to achieve that in what was essentially a reset, start from scratch project.

Problems like shopping carts and customer order history have been solved a zillion times before. Not having to reinvent the wheel allowed us to spend more time on building a great customer experience, streamlining admin workflows, and integration with point of sale and back office systems.

If you are into music, check Kosmic out. They are running great deals at the moment.

CalorieKing App Now Universal

We have released a universal version of the CalorieKing app.

CalorieKing App - iPad screenshot

Alfred As an Application Switcher

Alfred

Ever since OS X Lion, the number of spaces that I spawn has skyrocketed. As a result, I’ve found myself using Alfred more and more as an application switcher. I could be coding in a full-screened Vim session and need to refer to an email. Vim is in space #4 while Sparrow, my email client, is in space #1. I just need to invoke Alfred (cmd-space), type “sp”, and hit enter. I’m instantly teleported to the right space and Sparrow is made the foremost window. A keyboard driven workflow full of win. It doesn’t matter if I forget what space Sparrow is in, or whether the application window is minimised. Alfred the butler will serve me Sparrow on a platter.

How about the built in application switcher, the good old cmd-tab? I find that I only tend to use cmd-tab when I want to switch back to the previous application. Anything beyond that feels like too much work. It’s cmd-tab, tab, tab, tab – damn I overshot. Backtick. OK, finally there. Cmd-tab is serial access. Alfred is random access. With Alfred, MacVim is “vi”, Xcode is “xc”.

Alfred appeals to the Vim user in me. In Vim, I routinely hit / to invoke search to jump around code. Alfred is the / of my window management.

Our CalorieKing App Was Released Today

CalorieKing Calorie Counter App Screenshots

Our CalorieKing iPhone app went live today. It’s the first iOS project that I’ve been involved in. After spending the last few months in Xcode, I’m pretty happy to see it on the app store :)

Syncing Safari Bookmarks Using Dropbox

Update: Unfortunately this does not work. I find that Safari will overwrite my symlink with a new Bookmarks.plist file in ~/Library/Safari/. There’s a thread about this issue on the Dropbox forums.

Safari Bookmarks User Interface

If you have multiple Macs and use Dropbox, there’s an easy way to keep your Safari bookmarks in sync on your different machines.

Safari stores your bookmarks in a file called Bookmarks.plist in ~/Library/Safari/. Just move the file to your Dropbox, and create a symlink to it. I keep mine in ~/Dropbox/Sync/OSX/Safari:

mkdir -p ~/Dropbox/Sync/OSX/Safari
cd ~/Library/Safari
mv Bookmarks.plist ~/Dropbox/Sync/OSX/Safari
ln -s ~/Dropbox/Sync/OSX/Safari/Bookmarks.plist Bookmarks.plist

Then, on your other Macs, just delete the bookmarks file and create a symlink to your Dropbox.