Saturday, October 13, 2007

I Love Elegant Solutions!

I'm not lazy, but I can't stand to do repetitive tasks. They drive me nuts! When I first learned to program, my dad asked if there was some way to type out labels for an event he was running on that "fancy computer" at the place I worked. I said, "Sure, we have a fast 40 characters per second daisy-wheel printer!"

Now, I could have sat down, opened the Scripsit word processor on our cutting edge, TRS-80 Model I computer and just typed the 40 or 50 labels, but the thought made me cringe. It's doing the same thing over and over and over again. So, my solution was to write a program to do this mundane task.

The program took me longer to write than actually typing the labels would have taken, but I enjoyed writing the program and hated the thought of repetitive typing (this was before copy and paste so I really would have had to type each one over and over). For me, this was a more elegant solution.

Fast forward a quarter century and I had a similar problem while working with importing banking transaction into MoneyWell. Most U.S. financial institutions use the QFX/OFX file standard. These formats are better than the ancient QIF format and provide more information to MoneyWell, but both are total different and my QIF parser code is useless with them.

After reading the OFX specification (yes, of course I read all 665 pages—it was gripping prose) I thought I could use nice set of Apple routines to read these files since they looked to be in XML format (this is is arguably the most common format for transporting data between systems on the internet). Unfortunately, the older QFX format predated XML and dashed my hopes of not needing to write my own parser. It sounded mind-numbingly boring to have to do this, so I solved it by procrastinating and looking for someone else's code as a solution. Of course I didn't find any code that I liked or trusted.

I stared at the QFX files and spec until it struck me that the SGML format of these files is very close to XML, it just needed a little reformatting. How hard would it be for me to write code to do this? As it turns out, not very hard. It took about 20 lines of code. How perfect! That wasn't boring at all; instead it was a fun challenge to write a small efficient routine for this conversion and, when I was done, I had XML formatted information to feed to Apple's framework.

The non-technical summary is that I thought I had to deal with many different versions of files to import transactions into MoneyWell, but through a little thought (and a huge aversion to boring work), I was able to consolidate these into one file type. MoneyWell now reads all popular variations of U.S. bank files. It feels good to have found an elegant solution!

I may even release version 1.1 early with a limited set of this new functionality since it is working so well already. We'll see how well the testing goes.

Peace.

P.S.: Due to popular demand, No Thirst Software now has a user forum. Check out our support page for more information.