08-09-2024, 10:56 PM
Big fan of datatype sigils (suffixes). Although non-text characters generally annoy me, I very much like to see the data type on any identifier, and I find it much easier to search and locate identifiers when they have suffixes. (Suffixes make "false-positive" find much less likely, if not totally unlikely.)
Case:
GOSUB vs SUB:
GOTO: I'm a big fan of GOTO for very particular circumstances.
Case:
- all language keywords in UPPERCASE
- all variables in camelCase
- all function name, sub names, and line labels in PascalCase
- constants, completely inconsistent (I tend to lean UPPERCASE, but I'm not in love with it)
GOSUB vs SUB:
- I like to see the big picture view of a main program such that I do not have to scroll the screen up/down. So I usually reach for GOSUB as a way to compact main code (or GOSUB subroutines)
- If a subroutine is generic enough that I might use it in some other program, or if I don't want to risk a subroutine modifying global variables, or if the subroutine is for a recursive process, I'll be setting up a SUB subroutine
GOTO: I'm a big fan of GOTO for very particular circumstances.
- When a certain condition is TRUE (or FALSE) and we need to skip over the next few lines of code
- A loop in which I go to the Normal starting point, but in some circumstances I want to actually go a little bit before, or a little bit after, the normal starting point
- Endless loop (or one that is essentially endless), I'll reach for GOTO and a (descriptive label) before a DO...LOOP every time
- However, I won't allow spaghetti code (I.e. I don't want to be ping-ponging all over the place)