Whilst working on some EDI parsing I have been thinking about data validator attachment.
The classic pattern is to have an AbstractValidator and subclass as necessary. This results in a few more classes in the hierarchy and a lot of objects added unless you implement some sharing or a different approach with delegates.
Code Project has long been one of my favourite sites for example articles, ironically mainly in the MFC space.
I was surprised and impressed to read this morning that it held a Member’s Choice award for the first time and that REALbasic won the Best Programming Language category.
I hadn’t realised that REALbasic users were in the CodeProject community because there are zero articles on there about REALbasic. I guess the awards were publicised and people voted. I’m not disagreeing with the deserved result but I think it is ironic that a site which has a bunch of .Net categories, even listing C++/CLI separately under their language categories, found itself awarding this unknown language. Maybe now REALbasic will appear on there.
I was amused to find myself reading a posting analysing some of my code, which I’d followed because the title intrigued me – Strings Can Be Nil, Even If They Can’t Be Set To Nil
When Charles says he is surprised that some of my code works and Mars chips in and says he thinks it contains a redundant check, I get a little concerned. The port of rbrw-core was a lot of work converting thousands of lines of C++ so I may well have carried some C++ idioms across without thinking.
However, I am aware that a lot of the rbrw code uses variants and I may have written that test after a nasty experience (yes, it needs a comment, if so).
To assuage my curiousity and conscience, I flung together a quick check for variants and nil strings, available on Google Code.
The important bit is invoking the string with a variant, which does indeed appear to pass a nil string to a method, as seen below. Based on Charles’ comment, I’m leaving the verdict open – if indeed the string comparison of is nil is also fired by an empty string, we can’t tell what is happening unless writing plugins to explicitly return nil strings.
dim v as Variant
Sub TestString(foo as String)
if foo is nil then
print "Yes, Strings can be nil, if they come from an empty Variant"
Due to many distractions, it has taken a while for the port of OOFILE’s report-writer to REALbasic to achieve some usable state. I’ve just committed the first version which includes printing and crude preview to the rbrw-core repository. The directory layout may look a bit weird, with many empty directories. That is because most files are external XML format (under the top rbrw directory) but the VCP format used for the sample creates a hierarchy of empty directories.
I will be adding more documentation over the next few months explaining how to use the library and how it works (the latter proving more challenging than I realised – it’s been nearly 10 years since I did more than trivial extensions). In a bitter lesson about using digital documentation, the inches of paper-based design documents for the original product have been mislaid/filed in one of my house moves of the last decade.
This initial release does include a fairly comprehensive sample program showing how to create reports of various styles. Continue reading
I’ve been doing a huge amount of work recently porting the C++ OOFILE report writer to REALbasic as a complete transliteration, having given up on the earlier report-writer I was writing from scratch.
I’m using REALbasic 2008r4.1 and finding it extremely flaky when debugging. I finally worked out the cause and it’s an interesting trap.
OOFILE was written about 15 – 10 years ago and makes use of lots of inline and non-virtual functions for high-performance in C++. Methods in REALbasic are, of course, all virtual but it also has Computed Properties which allow you to write code as getter and setter functions. These are non-virtual and therefore (presumably) much faster – an ideal and idiomatic match for the inline getters and setters used heavily in OOFILE.
However, there’s one very big gotcha – if you look at an object in the REALbasic debugger, all its getters on computed properties are executed.
I have added a project at Google Code to host RB2Doxy in case anyone is interested in a solution to help document their REALbasic code. Currently it’s a bit limited in that it requires all your source to be in a single XML file and doesn’t process anything inside methods, just the class and method declarations. It may also appeal as an example of moderately complex XSLT processing.
The day started with a very nice breakfast and some weary arrivals who had been delayed yesterday by the lousy weather. Nice collection of goodies in the bag including a 1GB USB Key with all the presentations loaded (but not the keynotes).
Geoff came on and presented some interesting stats, last year being their best ever and including a major shift to Windows and Linux. The Linux version is their fastest growing by far.
I got into Austin Monday night after a very tiring few days in Columbia (Missouri) and Lake Dallas, including my first driving experience in the USA. Interestingly, driving was vastly easier than I had expected – I worked out it was probably aided by riding a motorcycle at home. My position on a freeway on the bike is about where a left-sitting driver sits in a car on a US road.
Very impressive lobby, room smells a bit musty but a day of my laundry drying in the bathroom leaves me no excuse to blame the incoming smell, wifi works reasonably well but very slow on uploads, like the room coffee, average health club and cool pool (drastically bad weather means I’ll possibly not be swimming on the rooftop).
Quick Trip to the Apple Store
The Apple Store in Austin is out at the Barton Creek shopping mall but it is a very easy ride from town. Catch the Number 30 bus from 11th St in front of the Capitol building, same side as the Capitol and $1 gets you a pass good 24 hours to ride about 35 mins out to the mall. It’s a typical big suburban mall with the added attraction of watching the security guards zoom around on Segways (OK, well it’s still new enough to me to be interesting).
I know this sounds a bit of a silly title because feelings are about things being personal but that was the phrase that came to mind. (Followed about 30 seconds later by blast, I’m writing in Safari again). I live in Safari and the need to fire up FireFox just to edit a post with a few paragraphs is driving me crazy. (Yes, I know about MarsEdit and other blog products but I’m trying to immerse myself in a certain consumer experience, even if it has lumpy bits.)
Anyway, this started out being about the REALbasic bug that just bit me and a particularly irritating one it is too – something broken when I open an old project. In a sense, it’s about the arrogance and greater responsibility of binary formats and owning the user’s entire life. Continue reading
RB2008r1 has shipped and the main feature is their addition of what they are calling Introspection. Some people regard them as synonyms but it seems the feature should more properly have been called Reflection as it not only allows you to read information about objects but allows their property values to be set and methods to be invoked. I’ve written an article for the upcoming vol6.3 of RBDeveloper magazine and you can download my sample application to play with Introspection now. For a good example of using the method invoke features, see Paul Lefebvre’s new release RBUnit 3.0.