Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Styles
#29
(08-10-2024, 04:28 PM)Pete Wrote: Right, because this thread is about style, and not so much code optimization.

I suppose another thing to mention about style is the importance of continuity. Go back 10+ years to look at some of your large older programs and I bet those who have continued with a same or very similar style have a much easier time of updating their code. This is why I think it is important that folks new to QB64 develop not only the best optimization skills, but the best style that suits them if they intend to stay with projects for many years.

Pete

Aye.  And I think as far as I'm personally concerned, I find the  "IF...GOTO finish" approach preferable to "IF....ELSEIF.....ELSEIF...." approach just due to the way my brain tries to process information.

IF x = 1 THEN 
    ... do stff
    GOTO end_process
END IF

My mind reads that, processes it as one complete segment, and then is done with it.  My brain narrow focuses here, and all I need worry about is that one, small fragment of code.

If x = 1 THEN
   ...stuff
ELSEIF x = 2 THEN
   ....stuff
ELSEIF x = 3 THEN
   .... stuff


With the above, my brain sees those as all continuous  control block.  It wants to understand EVERYTHING that's going on inside, before moving on and attempting any changes to the overall structure.

I suppose to me, it's kinda the difference between short sentences in writing, and endless run-on paragraphs.

I woke up.  I ate breakfast.  I got dressed.  I went shopping.  I ate lunch.  I died.

Compared to

I woke up and ate breakfast and got dressed and went shopping and ate lunch and died.

Independent, sequential thoughts, rather than needing to decipher one long continuous thought.

(Just to try and explain WHY my style is, as it is, for ME.)
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: 37 Guest(s)