Tuesday, January 17, 2006

RB CodeHelper Lite: Just Thinking Out Loud

I've made available an updated version of RB CodeHelper Lite. It had worked fine on other Projects which I had tried it on, but did not work properly with Thomas Tempelmann's helpful RB Project Tool.

I think I've fixed CodeHelper for now, but - because of RS's lack of full documentation of their XML format - working with XML is like "the scientific method," complete with its disadvantages which result in "temporary truth" at the best. I'm not an Einstein, but it's like progressing in the same way that Newtonian science "progressed" to Einsteinian physics.

That is, rather than being able to use the deductive method, which - given the proper premises - can provide "true truth," you have to be content with the inductive method, which provides at best "probable truth" or "temporary truth," which only works until something better comes along. Specifically, like F = ma my method of obtaining information on RB controls worked fine until Thomas Tempelmann's program came along (just like Newton's laws worked fine until they confronted the situation of particles moving at speeds close to the speed of light, where mass could no longer be considered a constant but was obviously related to speed and/or acceleration, hence e = mc squared).

Although my method worked with all previous cases, when Thomas Tempelmann's program came along I had to work out a different approach which would encompass both the earlier programs and Thomas's as well, which broke the earlier "rules" and showed them to be inadequate (just as the inductive statement "all bears are brown" is "true" until once comes across the first polar bear).

RS's way of phrasing the situation is this: "The XML produced by REALbasic is well-formed, but it cannot be "validated" because it does not include a 'document type declaration.'" What this means is this: "We won't tell you the rules. All we'll do is tell you that there are rules, and it's up to you to infer them as best you can." It makes it fun to work with XML because of the intellectual challenge, but it's also true that you don't know when you're going to meet your first polar bear. That is, the best I can say is that CodeHelper at a certain stage can handle all of the programs it has met thus far, but that is no guarantee that it can handle some program it hasn't met yet.

One other consideration to deal with: RS doesn't tell you the rules, because it changes the rules. Load an old program into RB 5.5.x, and save it as an XML file. Load the same program into RB 2005 or RB 2006 and save it as an XML file. Now compare the two XML files. The differences are considerable (e.g., the RB 2005 or RB 2006 XML file may be a hundred lines _shorter_ than the RB 5.5.x file!). Will my induced rules work with the new format? Maybe yes, but maybe no.

Fortunately, most of them seem to continue to work (including all of those in RB CodeHelper Lite, now that I've fixed the problem with handling Thomas Tempelmann's program), but they cannot be "validated," because RS does not make available a "document type declaration" (even though that is fairly standard procedure with XML formats). Let me give two examples of where what worked before no longer works.

Example #1: When you print out the source code from within the RB IDE, it ordinarily does NOT print out in alphabetical order. With RB 5.5.x, I worked out a way to manipulate the XML file so that it would put the Properties and Methods into alphabetical order when printed out from the RB IDE. That way no longer works.

Example #2: For some reason, RB will from time to time introduce empty event procedures in the XML file. They don't affect the running the program, but they are extraneous and unnecessary. (Essentially you'll have a Function line and an End Function line with nothing between them except perhaps a blank line.) With RB 5.5.x I worked out a way to remove those "empty" event procedures. That way no longer works.

How do I handle such situations? For the time being, I am not trying to put out two different versions of CodeHelper, but one version containing only those routines which work with all versions of RB from 5.5.x. on. If something works only with the 5..5.x version of XML, then that feature is removed (at least for now) from CodeHelper.

Programming can be an interesting endeavor and a real challenge at times....

Barry Traver

Home Page for This Blog: http://traverrb.blogspot.com/

Programs and Files Discussed in the Blog: http://traver.org/traverrb/


Post a Comment

<< Home