Sujet : Re: Should I write building blocks?
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 27. Jan 2025, 09:30:19
Autres entêtes
Message-ID : <yga7c6gr750.fsf@akutech.de>
References : 1 2
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
* Tim Wallace <
tp_wallace@yahoo.com>
| On 1/24/25 18:34, Luc wrote:
| > On top of my personal problems, the long periods of inactivity make
| > me very unfamiliar with my own code. Picking up where I left off is
| > hard. I have to read everything again and make heads and tails of the
| > whole thing and know where to look when the code throws an error.
| > It's so bad I sometimes decide to just start over, from scratch.
--<snip-snip>--
| Write comments before you write the code--explaining your thinking and
| plans.
I'd second that advice from Tim.
In addition:
- document the side-effects of functions calls (eg changing global
variables or state, in TCL: variable traces)
- document the "clever tricks" in detail (eg bit fiddling, relying on
hidden features, in TCL: variable traces)
- when changing *code*, check the *comments* as well and adapt them if
required
- write unit tests for your building blocks
HTH
R'