[Oberon] [EXT] Impartial observation? (Or silly blather from left field?); was: ALU 2015 and 2018.
Skulski, Wojciech
skulski at pas.rochester.edu
Fri May 13 23:34:42 CEST 2022
Peter:
>In first year computer science, two rules were easily prosecuted by a
>teaching assistant.
>(1) Use meaningful names. Eg. upperLimit means more than y.
>(2) Avoid magic numbers. Eg. AperyConstant is preferable to 1.2020569.
>From Van Tassel, "Program Style, Design, Efficiency, Debugging, and Testing", 2nd edition, 1978. Chapter 1, Program Style. The following programming mantra were highlighted by the author:
Programs are to be read by humans. Provide more comments than you think you will need. Use prologue comments. Use directory comments in long programs. Comments should provide something extra - not just paraphrase the code. Indent comments the same amount as the code they refer to. Incorrect comments are worse than no comments at all.
> ... 1...
> Violates (2)?
> And "One = 1" would violate (1).
The name in this case would convey the intended meaning, which is the location of the Interrupt Service Routine. I said "location" rather than "address" because "1" is not the address. So a proper name would be "ISR_location" or "ISR_slot", with a clarifying comment "// The ISR address == 4*ISR_location". The entire thing would become a local parameter or even a generic parameter settable from the top level.
W.
More information about the Oberon
mailing list