Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
For what it’s worth: Programming Clarity
#1
As someone close to the bottom of the “programming chain”, I just want to make a few comments on what makes programmes understandable, at least for me.  I know some members won’t agree with some of these things, and some seem pretty obvious, but I find they help me to understand someone else’s programming.
Comments: A few words at the end of, or before, a line that introduces new elements or features can be a great help, not only to other readers, but to the author when editing or reviewing later. They don’t greatly increase the programme  size, and are not included in the compiled programme, so why not use them?.
Variable Names: These should give an indication of what they represent. An abbreviated form, maybe with vowels removed, is often ok, but a full word is even better: “TopScore” is clearer than “TpScr”, and won’t be confused with say a “TopOfScreen”, but either one is better than “scmx%”. Some names will necessarily be a bit obscure, especially with advanced trig or system items, so may need a comment to give some indication of their purpose, when first introduced.
Labels: When a new section of a unit starts – whether in the Main or a Sub or Function – it helps if that section is spaced out, and given a meaningful label, telling the reader what the section does, e.g. “CheckBoundary:”. Although spaces are not allowed in labels, CapitalLetters or Under_Scores can be used instead.
Subs and Functions: should have a meaningful name that describes their purpose, and if necessary a comment explaining this.
Programme Names: These should give enough information to tell readers what they can expect to find in the programme. An Introductory page or paragraph that can be seen on opening can also be useful.
Many writers do these things as a matter of course, but occasionally they become so involved in making the programme smaller, or work or run faster, that these are overlooked, leaving readers like me mystified about the purpose of that section, or of the whole programme !
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
For what it’s worth: Programming Clarity - by PhilOfPerth - 07-26-2024, 01:34 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  QB64PE programming challenge? auto-convert image to photoreal etch-a-sketch drawing madscijr 9 1,859 02-14-2025, 05:49 PM
Last Post: madscijr
  Steve's Programming Challenge: Weights and Measures SMcNeill 23 3,964 08-16-2024, 08:49 PM
Last Post: Pete
  Vintage programming BigPete 4 893 05-15-2024, 09:57 AM
Last Post: BigPete
Question Just a heads up about the NSA list of memory-safe programming languages madscijr 5 2,258 03-06-2024, 05:21 AM
Last Post: TerryRitchie
  Chapter 20 Games Programming Terry's Tutorial bplus 3 920 06-29-2023, 08:12 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)