April 18, 2003   Tip of the Week Mailing List
The Tip

This week's tip is actually going to be a collection of tips for working with other peoples' code. I've inherited some code this week that is, to say the least, interesting. It has stretched my debugging skills to the limit, so I thought I'd share some of the tricks I've used to get to the bottom of what this code is doing.

  1. Use the Functions and Variables windows to track down where they are using their custom variables and third party functions. The "Show Icon" button will help you find where things are being set and how they are used.

    You can also use this to get rid of unused functions and carefully delete unused variables.
     
  2. Use the Find window when a variable is referenced a lot of times to find out how it is set. It may be obvious, but searching in Calculation text for MyVariable := and MyVariable:= can save you a lot of time. If you know what value you're looking for, it can save you even more time.
     
  3. Use the Trace window to figure out how the flow is getting from one point to another in the program. I find it helpful to insert a stop flag at a strategic point, then use the Step Over and Step Into buttons on the Control Panel to watch the flow in smaller chunks.
     
  4. If you use Ctrl+B and can't figure out where in the flow you are, Control-Click the title bar of the current window to see what windows it is nested inside. Also note that each window has a Level indicator in the upper right hand corner that tells you how deep you are.
     
  5. Use the "Connections" window to quickly find related icons in other parts of the program. For instance, if you see DisplayIcon(@"Some Icon"), you can quickly find Some Icon by right clicking the calling icon, selecting "Connections," and clicking "Show Icon" under the "From" column with "Some Icon" selected.

    This is especially useful if the developer has used lots of GoTos, since it will help you quickly unravel those relationships.

It's worth mentioning that if you are deleting apparently unused variables, you should check to make sure they are not put together at runtime with Eval or EvalAssign. You can do this by checking the Functions window for uses of these functions. You should also check to make sure these variables are not passed to this file in a JumpFile or JumpFileReturn call.



 
Did you know?

The FileIO Xtra is a very underused feature of Authorware. FileIO stands for File Input/Output, and, as the name suggests, it is often used for reading files and writing to them, especially when you need to read and write large amounts of data.

But FileIO contains other functions that are just as useful, if not more useful. For instance, you can use the DisplayOpen function to show an Open File dialog box to allow users to select a file, such as an external graphic for display in Authorware. You can also use getOSDirectory to find the Windows (or Mac) Operating System directory.

TAAC History Lesson

I was surfing through Google Groups, looking for something else, when I came across the notes from the first TAAC. I thought it was an interesting bit of history, and I thought the notes were still of interest today.


Feathered Friends

Now that I'm back in my Mississippi house with its spacious back yard, I take the cats outside for a few minutes of sunshine and fresh air every day.

picture of my cat Jake
Jake

picture of my cat Tux
Tux

They have, apparently, made a friend, a Mockingbird who comes to sit in the small tree behind my house, just a few feet away from us, and chirp companionably while we putter around. Our bird friend also sits in the tree outside the front window and chirps at cats on the window sill. I wonder whether the bird knows what would happen if it ever got close enough to cement the friendship.


Free Digital Images

I've spent a lot of time looking for free images on the web. Usually I wind up at a clip art site with a limited stock of poor quality images, with lots of popups.

Recently, there was a discussion on the macromedia.fireworks newsgroup about this very issue. It yielded up a nice selection of free clip art sites. My favorite of these was Copyright-Free Photo Archive: Public Domain Photos and Images. Great stuff!