UnWise

I’m not happy today with one of the products we use to create install packages.  Mostly because I had to use it.

This “programming” environment was designed (I presume) to be easy for non-programmers to use.  You create your script by dragging statements from a box and dropping them on your script window.  Then you double-click the line in your script to add your fill-in-the-box details.  It’s seriously tedious at best.

The “code” display is opaque and misleading – you have to click open each line to find out what it really does.

I was fixing an issue with the sequence of dialogs leading up to an install.  After the user selects a port, we verify that the selected port is valid and available.  The problem is we were checking about six times, and the last time made something bad happen.

The code looks something like this (where I replaced a function call with a message):

Wizard Loop

 Custom Dialog “Welcome”

 Custom Dialog “Select Installation Directory”

 Custom Dialog “Select Installation Port”

 /* Call DLL “support.dll” Function “ValidatePort” */

 Display Message “test”

 Custom Dialog “Start Installation”

End

Strangely, the output was

“test”
“test”
“test”
“test”
“test”

Not quite what the code implies.

It turns out that the code above turns into psuedocode something like this:

DISPLAY = “Welcome”
Do {
	If( DISPLAY == “Welcome” ) {
		Show Dialog “Welcome”
		OnNext set DISPLAY = “Select Installation Directory”, DIRECTION = N
		OnBack set DISPLAY = “Welcome” , DIRECTION = B
 	}
	If( DISPLAY == “Select Installation Directory” ) {
		Show Dialog “Select Installation Directory”
		OnNext set DISPLAY = “Select Installation Port” , DIRECTION = N
		OnBack set DISPLAY = “Welcome” , DIRECTION = B
 	}

	If( DISPLAY == “Select Installation Port” ) {
		Show Dialog “Select Installation Port”
		OnNext set DISPLAY = “Start Installation” , DIRECTION = N
		OnBack set DISPLAY = “Select Installation Directory” , DIRECTION = B
 	}

	/* Call DLL “support.dll” Function “ValidatePort” */
 	Display Message “test”

	If( DISPLAY == “Start Installation” ) {
		Show Dialog “Start Installation”
		OnNext set DISPLAY = “done” , DIRECTION = N
		OnBack set DISPLAY = “Select Installation Port” , DIRECTION = B
       }
}

While( DISPLAY != “done”)

That’s right – the program flow goes through the loop over and over, in one direction, and depends on a couple of global variables to determine which little bit to execute.  The appearance of order is (mostly) illusory.  While this design might work fairly well for a sequence of dialogs, it does not extend well beyond that.  You can make this work, but it is not easy, and is much more complex than it needs to be.

This is yet another case of making simple things easy, but making hard things impossible (or at least much harder).

Comments are closed.