Friday, January 06, 2006

More Info on What CodeHelper Lite Can Do

Last time I provided a list of the seventy-seven tasks that CodeHelper Lite can perform. In this entry, I will provide more of an explanation concerning some whose usefulness may perhaps be less obvious.

Sometimes it is difficult to follow the logic or keep track of what's going on in long nested For/Next loops or complicated and lengthy If/End If statements. By the time you get to the "Next" line, you may hve forgotten what the matching "For" line said. Or, if you have nested If/End If statments in your code, when you get to an "Else" line or an "End If" line you may have forgotten what the original "If" statement said and/or whether that condition still applies to the section of code you are working on.

To help you keep track of where you are, CodeHelper can "Add Automatic Comments" to lines that begin with "Next" or "Else" or "End If." Here are an example taken from CodeHelper:
 For XMLLineNumber = 0 To UpperBoundXML
... [more code here] ...
If IsSource(XMLLine) Then
... [more code here] ...
If RightTemp = "_" Then
... [more code here] ...
ElseIf Temp <> "End Sub" _
And Temp <> "End Function" Then
... [more code here] ...
For Counter = 1 To NumberOfBlankLines
... [more code here] ...
Next Counter '/ For Counter = 1 To NumberOfBlankLines
... [more code here] ...
Else '/ (Caution: at least one ElseIf in this statement)
... [more code here] ...
End If '/ (Caution: at least one ElseIf in this statement)
End If '/ If IsSource(XMLLine)
Next XMLLineNumber '/ For XMLLineNumber = 0 To UpperBoundXML
Note the automatic additions to the "Next," "Else," and "End If" lines. Here's another example:
  If Temp1 = "As" Then
... [more code here] ...
If Regexmatch1 = Nil Then Exit
... [more code here] ...
If Temp1 = "New" Then
... [more code here] ...
If Regexmatch1 = Nil Then Exit
... [more code here] ...
Else '/ If NOT (Temp1 = "New")
... [more code here] ...
End If '/ If NOT (Temp1 = "New")
End If '/ If Temp1 = "As"
"Comment Out Source And Add MsgBox" was used in the making of CodeHelper Lite from CodeHelper. Running this routine comments out the entire source code but puts MsgBoxes in Methods so that the MsgBox indicates the Method it is in.

I then chose which features in CodeHelper I wanted to include in CodeHelper Lite, and uncommented those Methods (and removed the related MsgBoxes). Then I ran the program, and the MsgBoxes which appeared showed me which additional Methods needed to be uncommented (and MsgBoxes removed).

Finally, after I was fairly sure that all of the routines I wanted were working, I removed those unnecessary Methods that were still commented out (and thus had not been called). (If I made a mistake and deleted something that was really needed, RB's syntax chedcking would let me know of that fact, so that I could put it back.) As I went along, I removed from the menus those features I had decideed not to include in CodeHelper Lite, so the end result was a program that was a working subset of the fuller CodeHelper program.

We'll come back to CodeHelper and CodeHelper Lite later, but I'll be switching to a different topic temporarily in the next blog entry. And more files will be available soon. Hang in here!

Barry Traver



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

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

0 Comments:

Post a Comment

<< Home