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.
- 1.
- Generate GUI objects that reflect dynamic information from that information,
rather than hard coding your application.
- 2.
- Use data structures that can be extended dynamically. Use variables for
associative array indices where possible.
- 3.
- Generate switch structures dynamically, rather than hard coding them.
- 4.
- Put platform specific information in files to be sourced, rather than
within large
if
statements.
- 5.
- 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.
- 6.
- Avoid exec.
- 7.
- Use a single global array instead of many uniquely named global variables.
- 8.
- 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.