Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Styles
#13
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:
  • 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)
Reply


Messages In This Thread
Coding Styles - by Pete - 08-09-2024, 03:09 PM
RE: Coding Styles - by SpriggsySpriggs - 08-09-2024, 03:21 PM
RE: Coding Styles - by TerryRitchie - 08-09-2024, 05:29 PM
RE: Coding Styles - by Pete - 08-09-2024, 03:54 PM
RE: Coding Styles - by bplus - 08-09-2024, 04:03 PM
RE: Coding Styles - by SMcNeill - 08-09-2024, 09:03 PM
RE: Coding Styles - by Pete - 08-09-2024, 04:16 PM
RE: Coding Styles - by SpriggsySpriggs - 08-09-2024, 06:40 PM
RE: Coding Styles - by TerryRitchie - 08-09-2024, 07:52 PM
RE: Coding Styles - by Jack - 08-09-2024, 07:10 PM
RE: Coding Styles - by Jack - 08-09-2024, 07:19 PM
RE: Coding Styles - by Kernelpanic - 08-09-2024, 10:29 PM
RE: Coding Styles - by CharlieJV - 08-09-2024, 10:56 PM
RE: Coding Styles - by Kernelpanic - 08-09-2024, 11:21 PM
RE: Coding Styles - by CharlieJV - 08-09-2024, 11:27 PM
RE: Coding Styles - by Pete - 08-10-2024, 03:46 AM
RE: Coding Styles - by SMcNeill - 08-10-2024, 04:55 AM
RE: Coding Styles - by JRace - 08-10-2024, 09:41 AM
RE: Coding Styles - by SMcNeill - 08-10-2024, 10:43 AM
RE: Coding Styles - by OldMoses - 08-10-2024, 12:08 PM
RE: Coding Styles - by CharlieJV - 08-10-2024, 02:11 PM
RE: Coding Styles - by Pete - 08-10-2024, 02:55 PM
RE: Coding Styles - by bplus - 08-10-2024, 03:19 PM
RE: Coding Styles - by SMcNeill - 08-10-2024, 03:41 PM
RE: Coding Styles - by Pete - 08-10-2024, 04:28 PM
RE: Coding Styles - by SMcNeill - 08-10-2024, 11:08 PM
RE: Coding Styles - by Kernelpanic - 08-10-2024, 06:00 PM
RE: Coding Styles - by Pete - 08-10-2024, 07:30 PM
RE: Coding Styles - by TerryRitchie - 08-10-2024, 07:53 PM
RE: Coding Styles - by TempodiBasic - 08-11-2024, 12:46 PM
RE: Coding Styles - by Pete - 08-11-2024, 06:45 PM
RE: Coding Styles - by Kernelpanic - 08-19-2024, 06:35 PM
RE: Coding Styles - by quickbasic - 09-04-2024, 06:09 PM
RE: Coding Styles - by dano - 09-09-2024, 12:46 AM



Users browsing this thread: 22 Guest(s)