Last week I did an unusual two days consulting project, to help a Delphi developer find a long lasting bug. He wrote his experience, giving me permission to publish it on my blog. Incidentally, Bart works for Sevensteps, a company that's selling a very nice Delphi application to a some of the largest software companies in the world, including Microsoft, Google, and SAP. Yes, these companies use a Delphi application internally for documentation purposes.

It's a bugs life

I've been programming for ..., well, since ever really. The first programs I've written were on paper cards, ticking boxes with a pencil. Those cards were send to a computer center which returned me the output the following week. Yes, I'm that old.

For a decade or so, I've been working with Delphi and much to my pleasure I might add. But, two years ago something happened. I have a couple of programs out there with a couple of hundred users and some of them were sending in bug reports that I couldn't explain. I looked all over the place for the cause of these reports but I simply couldn't find it.

I knew they were related to this text editing control I was using abundantly, and I dug deep into the source code of it, but I couldn't find a problem there. I was beginning to doubt myself. I knocked on the door of the developer of the control, but he asked ridiculous prices, even to *start* looking at the bug. And for all I knew, the control was actually causing the problem. So, even though I was in big trouble, my pride told me not to pay for solving a bug - at least not to the one who caused it.

I continued my hunt, sometimes giving up, sometimes digging deep. I made some small progress, but nothing that completely took it away.

Then, one day, I saw a news posting somewhere that Marco Cantu was starting a new service to help you out if you have any problems in finding solutions in Delphi software. Although the posting focused on new software and thoughts, I contacted him to see if he wanted to dig into this existing problem.

Soon we agreed on a reasonable fee; one for when we would find a solution to the problem and one if we wouldn't. Now, that's confidence: no hassle, no long e-mails, more like a gentleman's agreement.

I made the necessary travel arrangements and went to Piacenza (near Milano) in Italy. After going through some things I found out earlier and showing some of the bug reports to Marco, he concluded it must be a problem with memory management. We grabbed WinDbg (Microsoft debugger) and very soon we cold confirm that there actually was a problem with that. After having a great lunch we worked a little more, but because of other arrangements I had to leave early that day. But, we already made some real progress.

The next day we soon were able to create a small program that reproduced the problem (something I wasn't able to do the previous two years) and after that, the rest was easy. There was a problem with heap memory and it was due to some timing problems inside the control. Working around the problem didn't take more that a couple of lines of code and I can tell you I was elated! Just by having the correct assessment of the problem we were able to come up with the solution I was looking for for two years.

I couldn't have done it without Marco's expertise and - in the end - it was really fun working together on this. Peer programming really is a joy if you make more progress than working on your own (which not always is the case really).

I can recommend Marco to anyone, not only to novice programmers, but to very experienced once also. He has a quick mind, great expertise and is very friendly and makes you feel welcome. I'm sure to contact him again is something comes up that I can't solve alone.

Bart Roozendaal, Sevensteps

Final Comment

What can I add, I really enjoyed working on this issue, which was far from simple, but as most programmers tackling challenging issues is something I like, even more if I can find a solution... I have to say I'm debugging a program of my own for several weeks now, with much less success... Maybe I need someone else to have a look!