Archive for the 'Code' Category

Money Management

Posted by alex on June 24th, 2008

Money Management

Knowing how much we spend on what is a problem everybody faces and people have come up with many different solutions based on their needs. Personally, I’ve found I’m too lazy to maintain an Excel spreadsheet and I don’t trust myself with having no system at all.

I first started looking at money management software when I first heard of mint.com. It looks like a great service but unfortunately doesn’t support UK banks yet. Next I looked into desktop software that might offer a similar set of features. There are plenty out there such as MS Money, Moneydance, Quicken, GNU Cash etc. Unfortunately all of these lacked some essential feature (such as auto-categorisation), were too difficult to use or too expensive.

So I started looking into writing my own application with the features I wanted. This would have a line chart showing my overall balance over time, a pie chart showing the breakdown of my expenses into categorisation. And of course transactions would be loaded and automatically cateogrised with the minimum level of fuss. On this point I wrote an application that automatically logs into my online bank account and downloads my statement in csv format. While I eventually got this working (not a trivial task) I realised it was too clunky and fragile as it’s likely that my bank will change their online interface at some point in the future.

Next I looked into downloading transactions from my bank via the OFX protocol. This is the protocol that lots of banks use to allow software the ability to download transaction information and also potentially execute transfers. It was not easy to find the information I needed to connect to my bank (Nationwide) via OFX as the bank’s details are not officially published. Microsoft use these details when connecting to Nationwide with MS Money. I had to do quite a bit of digging until I found a link on a newsgroup to a file hosted by Microsoft containing the necessary details for connecting to Nationwide’s OFX server. Armed with this I posted the details to a thread on the Moneydance forums. That was 7 months ago and Moneydance have still done nothing about using my information to add support for Nationwide despite a lot of requests from other forum users.

I moved on from the downloading transactions part of my application to the application itself. I figured it would still be useful even if I had to occasionally download transactions manually. Here’s what I came up with:

I even came up with a decent categoriser dialog:

With the application itself shaping up I went back to the transaction download problem. This time I found a nice snippet of Python code for connecting to a server via OFX. I translated this to a Java application that could download a list of my accounts from Nationwide, then download a list of transactions within a certain date period from a given account. This program is available for download here.

Now that I had the ability to download OFX statements from my bank, I looked into the other management services I initially dismissed because I could only import data via OFX. Wesabe was one of these so I tried creating a new account but lo and behold, they now suddenly support Nationwide for automatic uploads. This means they do the whole OFX download themselves automatically. This was great as now I don’t need any manual process at all to see my transactions nicely split into categories. The funny thing was, support was added the same day that I finished making the OFX downloader and this was thanks to my initial investigative work into the Nationwide OFX server details. Someone had picked up on my post in the Moneydance thread, given the details to Wesabe, who within just 9 days integrated support for Nationwide into their application. So great work guys, you well exceeded my expectations and I’m glad I could help other fellow Nationwide users.

Now that little saga is over, onto the real issue of the software itself. The great thing about Wesabe is that I can view and manage my transactions from anywhere. This means I can log on while at work and enter what I spent in cash for lunch. The bad thing about Wesabe is that it doesn’t give a breakdown your expenses as a pie chart and it doesn’t present your overall balance as a line chart.

To rectify this I’ve chosen to abandon my Money Monitor program and try to go in a slightly different direction. I’ve always wanted to learn .NET programming so my next project will be to create a ASP.NET application that connects to Wesabe via the Wesabe API. Downloads transaction data and displays it all in nice pretty graphs. Stay tuned for updates!

Real Life Software Development

Posted by alex on January 8th, 2008

There are plenty of websites and blogs discussing which techniques and methodologies we should use as software developers. When should and shouldn’t we use the Singleton pattern? Should try to future-proof code against possible changes in requirements or should we make sure it only fulfils our immediate needs? Should we write self-documenting code or short and quick to type with explanations left in comments? Which web framework is best, Tapestry or Wicket?

Asking these kinds of questions is a good way to learn about new technologies or techniques you have have not been familiar with and can give you a lot of insight into other parts of the software development world. You can apply some of these pieces of knowledge to broader parts of your job. For example, learning that perhaps using a Singleton pattern was not such a great idea you may decide to review the other parts of your application where you chose a common design pattern over a possible simpler design.

But there is a downside to learning about these new technologies and techniques and that is realising that even if you have a better solution, you may well not have the power to implement it. If you have a well developed web application based on JSF, it’s probably too late to consider using something like Ruby on Rails when you realise it’s better suited to that technology. An established database application based on SQLJ technology is going to be practically impossible to migrate to a much better technology such as Hibernate.

But this is a well known problem in software. You make your choice of technologies at the start of the project. If you need to switch half way through that’s too bad because you’ll just have to pay some high paid consultants to walk you through the process.

Another well known problem is that of technical debt. You write some quick hack to implement a feature or fix a bug as quickly as you can knowing that it could be done better if you just had more time. When you have that time, you tell yourself, you will come back to that problem and implement it correctly. Only that time doesn’t come. And even if it does, well your hacked together solution has been working fine on production for a few weeks now and it hasn’t caused any problems so why bother changing it and risk breaking the same part of the system again?

There are many proposed solutions to prevent the build up of technical debt such as unit testing, code reviews, proper architecture and design meetings, scheduled code maintenance time etc. The problem is there are not many solutions for how to pay off technical debt once you’ve incurred it. In the financial analogy it’s not so hard because you know how often and how much you need to pay back. With technical debt it’s very difficult to measure and it’s even more difficult to pay back.

We come across bad code all the time. “Why didn’t they create a list of objects instead of using a big array” we ask. We could change this code ourselves but it’s too late. The array is used throughout almost all parts of the application. Any change to it now would introduce a big risk or breaking something, or even worse subtly change the behaviour such that it goes unnoticed until it goes live. There are many factors that can make paying back technical debt very difficult. Maybe if we examined them in detail we might find ways to start tackling the task. The worst thing however, is coming up with a great solution to a problem in an application and simply not being able to implement it due to the risk of breaking the entire system.

New Projects

Posted by alex on June 16th, 2007

As I promised in my ‘To-Do’ list a while ago, I’ve added some of my old projects that I’ve been meaning to include on this site for a while now. It’s unlikely that many people will find them useful (except perhaps my Download Meter Utility) but I like to keep them here for prosperity more than anything else. I spent a lot of time on some of those projects so it would be a shame if they were to disappear without having before seen the light of the web.

I’m also slowly beginning to fulfill my goal of developing a proper C++ application. At the moment I’ve successfully set up the MS Visual C++ 2005 IDE and compiler as well as the wxWidgets GUI library. Hopefully I’ll even be able to make cross platform applications now that I have the tools set up. The first task I will attempt will be the Project Euler compendium. I already have the design set out in my head and could probably code it up in Java within a day. In C++ though I’d expect it to take a few weeks for me to get the basics hammered out.

Shyguy

Posted by alex on May 26th, 2007

I’m in the process of trying to finish of Shyguy and I always feel it’s good to note down what remaining tasks you have at this stage of development. I also find it’s good to publish them to instill some degree of commitment to actually attempt the tasks.

  • Add bonus timer
  • Add loading screen
  • Add special effects for bonuses
  • Add instructions
  • Add desktop shortcuts option
  • Alter highscore table to use a database

That’s all I can think of right now. I will probably have a couple more things to add as I progress. Right, now back to work…

Things to do

Posted by alex on April 29th, 2007

I thought I’d make a list of some projects and tasks that I’d like to complete sometime in the future. It seems that right now I don’t have much more free time than I need to shop, cook, eat and sleep but if I write something down here hopefully it will give me a better idea of how to organise my time.

Website

  • Create a new front page of the site and move the blog to the sub page. done
  • Add more projects and content to the site. done
  • Integrate my photo gallery to the site and upload all my digital photos. in progress
  • Add a personal section including a CV.

Projects

  • Finish Shyguy’s Cave of Death. done
  • Finish the Word Dissociation Game.
  • Start on a new Slick based project (maybe a multi-player rpg of some kind).
  • Learn C++ by creating a Project Euler solution compendium. in progress

Other

  • Sort out my finances.
  • Save enough money to buy a PC.
  • Tidy my room.

I’m sure there are more but I think that’s more than enough to get me started.