This paper demonstrates some techniques I used to make TclTutor easily extendable without need to modify the base code. From these examples and my experiences, I'll propose a few suggestions for Tcl applications writers. Some of these are obvious, but experience indicates that most are observed in the rewrite rather than the prototype.

Generate GUI objects that reflect dynamic information from that information, rather than hard coding your application.

Use data structures that can be extended dynamically. Use variables for associative array indices where possible.

Generate switch structures dynamically, rather than hard coding them.

Put platform specific information in files to be sourced, rather than within large if statements.

Restrict filenames to 8.3 early in the implementation process. If the package has any value, someone will want to move it to that platform eventually.

Avoid exec.

Use a single global array instead of many uniquely named global variables.

Use a single list of package globals, instead of declaring the required globals in each proc.

[Contents] [Previous] [Next]
This document was translated by troff2html v0.21 on July 18, 1997.