Patching A Class VMT

[Estimated Reading Time: 6 minutes] Caution: The contents of this post may cause dizziness or nausea.  Take only as prescribed and if symptoms persist seek professional advice. Recently I found myself needing to do something I had never done before – create an instance of an arbitrary class derived from some base class and destroy it, and do so without invoking any constructor or destructor code that the derived class(es) may have introduced. This is the difficult bit. Impossible?  Don’t be silly, this is Delphi we’re talking about….

Another Week, (Yet) Another Poll

[Estimated Reading Time: < 1 minute] Last weeks poll was interesting – I was surprised to see such a high proportion of those polled indicating that they don’t do unit testing – slightly more than 50% in fact.  It wasn’t a huge sample size, but even so it surprised me. So that got me thinking about the use to which visitors to my blog are actually putting Delphi – unit testing isn’t relevant to everyone of course – and so I thought it might be useful to ask that question this week. This is another multi-response poll.  You may choose all the answers that apply to you.

Making A Splash

[Estimated Reading Time: 5 minutes] OK, so who hasn’t done this a million times – adding a splash screen to a Delphi application.  I’ve seen any number of “easy” ways to do this but during a session at Tech Ed ’08 this week I saw the latest in splash screen technology from Microsoft:  A SplashScreen API and build action supported by WPF 3.5 and VS 2008. I immediately thought of my Application psuedo-class and object in Deltics.Forms.

This Week’s Poll, Delphi at Tech Ed and 2009 Ship Date

[Estimated Reading Time: < 1 minute] Since I’m preparing a series of posts about (and eventual publication of) Smoketest, my own testing framework, I thought I’d test the water with this weeks poll and see what – if anything – people are already using as far as unit testing goes. Also I thought I’d briefly mention that I am at Microsoft Tech Ed ’08 (NZ) this week, and it was good to see that the NZ CodeGear reseller, Developer’s Inc were handling a steady stream of traffic at their stand where Delphi 2009 was on display (in the form of data sheets :)). I asked when Delphi 2009 was expected to ship and was told that it had been released to manufacturing and was on target to start shipping on 20th September – I forgot to ask whether that was an NZ date or worldwide. Not quite from the horses mouth, but pretty darn close. 🙂

Class Helpers – Ruling from the Appellate Court

[Estimated Reading Time: 4 minutes] My previous post on class helpers provoked a passionate response from some quarters who believed that they could be used “safely”.  More worrying was an apparent belief that their use was actually endorsed by CodeGear – tacitly or otherwise.  A rather odd view given the advice from CodeGear themselves is to not use them. No-one actually described a safe usage scenario though and those scenarios that were described all contained immediately apparent flaws of their own.  However, I have realised that there is, if not a safe way then at least a responsible one, to create class helpers. Using them is still not entirely safe however.

Class Helpers On Trial

[Estimated Reading Time: 5 minutes] Class helpers (introduced in Delphi 2007 2006 2005 – thanks to Chris and Bruce for the corrections) seem to be cropping up more and more frequently in suggested work-arounds or implementation approaches.  I find this worrying given that this language feature has always come with the admonition from CodeGear that it isn’t advisable to use it! So why do people seem so keen on using them, and why shouldn’t they?

Exchange() – Epilogue and Smoketest

[Estimated Reading Time: 5 minutes] A colleague of mine directed me to a further minor refinement of the ‘final’ Exchange() code I posted the other day. The change is minor but yields a worthwhile performance improvement, but my main reason for bothering to post (yet!) another update is an excuse to introduce the testing framework I developed that allowed me to quickly assess any benefit.

An Exchange() For All

[Estimated Reading Time: 3 minutes] Following on from yesterday’s post, Barry Kelly (CodeGear engineer) kindly clarified a few points, one of which was that Generics support in Delphi 2009 won’t extent to unit procedures, only class methods, so speculation about a possible generic implementation of a Swap()/Exchange() routine was rendered largely academic. Not to be dissuaded I came up with this solution to meet my current and quite possibly future needs.