My code (in a single file) is getting bigger and bigger. Is there any way of seperating parts of my code into seperate files yet be able to run my code. ?
The most common technique is:
[ul][li]Make sure you use procedures to as great extent as possible, rather than having massive amounts of "in-line" code. This also makes it easier to test individual code bocks on a procedure-by-procedure basis, as well as making it easier to follow the program's logic.[/li]
[li]Group related procedures into separate files.[/li]
[li]Have a "main" application file that sources all the module files, and then begins execution.[/li][/ul]
So, your main application file would end up looking something like:
Code:
source init.tcl
source stats.tcl
source help.tcl
# And then, assuming that you've created a procedure
# called "main" that actually gets the ball rolling,
# just call it.
main
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting,
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.