Connecting to SQL Azure with dbExpress

Did you notice that there is a free trial of SQL Azure? Well, I stepped into it – just to gain experience. Continue reading

Posted in Delphi, Programming | 1 Comment

A DUnit Folder Iterator Extension

You have unit tests, don’t you? Or at least you run some tests to make sure your recent changes broke something?

These regression tests are vital to any serious software development. What would your customers say when they get a new version breaking their day to day work? Well, at least I can’t afford that – and be it just that I’m not keen to fix those problems at a customer under high pressure. So I have regression tests. Continue reading

Posted in Delphi, Programming | Comments Off

Windows 7 Previews – the Delphi Way

In the ancient days of Windows XP and Delphi 7 I used to provide a preview of the proprietary file content inside the file open dialog of one of my applications. This was accomplished by deriving from TOpenDialog, just like the TOpenPictureDialog does that comes with Delphi itself.

The drawback was that since Windows Vista this was no way to go when you wanted to use the new Vista style dialogs. This was an even more nuisance as the new dialogs already come with a preview ability – so why not use it directly? Continue reading

Posted in Delphi, Programming | 12 Comments

On Upgrading Delphi

Back from Delphi Developer Days (Kudos to Marco and Cary) and after cleaning up the mess in my inbox I would like to share some thought I had during one of the sessions named “Delphi: Today and Tomorrow”.

Some of the attendants mentioned they were still working with older Delphi versions and even if the newer versions were laying around they refused to make the step migrating their applications to the current Delphi XE. One argument from a fellow developer working still with Delphi 2007 actually alerted myself as he rated the step from Delphi 2007 to Delphi 2009 a very big one regarding the Unicode migration, but the step from Delphi 2010 to Delphi XE seems rather small, which makes himself unsure wether to make the migration to Delphi XE now or wait for the next version to come.

Honestly, I don’t get that. There already is a large step from Delphi 2007 to Delphi XE. Why making it even larger? What about “divide and conquer”? Do you really expect the migration to XE2 being easier than that to XE? Continue reading

Posted in Delphi, Programming | 28 Comments

Synchronize and Queue with Parameters

In Delphi’s TThread class there is Synchronize to call a method in the context of the GUI thread. This is necessary in case, for example, you want to update a progressbar or a status label in a form, because the VCL is not thread safe. While Synchronize is a blocking method (i.e. the thread code continues when the GUI thread has finished the method call), recent versions of Delphi introduced a non-blocking Queue method.

The drawback of using Synchronize is that it is very cumbersome to handle parameters during such a call. The standard solution is to use fields in the TThread descendant holding the parameters during Synchronize, but this won’t work properly with Queue. Continue reading

Posted in Delphi, Programming | 12 Comments

The Visitor Pattern – Part 4

The interface approach introduced in Part 2 of this series and extended in Part 3 did cover most of our needs. But there is nothing that can’t be done better with the right tools.
Continue reading

Posted in Delphi, Programming | 4 Comments

The Visitor Pattern – Part 3

In Part 2 of this series we learned about a more flexible implementation of the Visitor Pattern than the traditional approach. But we can do better.
Continue reading

Posted in Delphi, Programming | Comments Off

The Visitor Pattern – Part 2

In Part 1 of this series we learned about the benefits of the Visitor Pattern and saw a basic approach according to the GoF description.

As clean and elegant the visitor pattern might look in the first place, it nonetheless has its disadvantages. Say, we want to add a new shape TShapeTriangle. We have to do it inside the same unit the other shapes are declared. As the shapes reference the visitor and the visitor references the shapes we have to put all shape classes together with the visitor into the same unit. Although this might work in some smaller scenarios, it definitely doesn’t in most of the real ones. Probably this is one of the reasons why the Visitor Pattern is not as famous as it should be.

Can we find a solution? Yes, we can!
Continue reading

Posted in Delphi, Programming | 2 Comments

The Visitor Pattern – Part 1

Some of you might have already heard of the Visitor Pattern, especially if you have read the GoF book Design Patterns, but do you really use it? Do you use it often?

The common answer to this question is No. Once I was even confrontated with the question “Does anybody use it in real code at all?”.

Well, I do – and here I’m going to explain the why and the how. Actually there are different hows and at the end I will introduce a real elegant how
Continue reading

Posted in Delphi, Programming | 1 Comment

Anticlimax

It looks like the recent preview of RAD Studio XE didn’t met expectations of many developers resulting in a massive popular outrage.

Beleive it or not, but ranting and shouting will not change anything about the upcoming release. I suggest to calm down and start talking decently with each other.

Obviously the people at Embarcadero have something to explain and just missed the point to do it properly in advance. That might have been the wrong way, but honestly, we are all human and talking about bad news is nothing we are keen to do.

So be generous. Imagine you were in their position. Let DavidI and Mike Rozlog take a breath, wait what they have to say and then decide on the information you get.

Staying with Delphi or going away is no decision that has to be done today or tomorrow. It should neither be done during a heated situation like we have now.

After all we are still developers. We are used to tackle a problem with logic instead of speculating and ranting. I am not aware of any bug that has been fixed by shouting at it.

There is something going wrong, no question. Lets start a debugging session and find out what it is and how to fix it.

Posted in Delphi | 27 Comments