[Oberon] Coding practice
Chris Burrows
chris at cfbsoftware.com
Fri Feb 21 00:23:18 CET 2020
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Skulski, Wojciech
> Sent: Friday, 21 February 2020 1:20 AM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] Coding practice [Was: Re: Hennessy.Mod 64kB
> limit]
>
> Joerg:
>
> let's strike a deal:
>
> IF
> a[i] > a[i+1] THEN temp := a[i]; a[i] := a[i+1]; a[i+1] := temp
> END;
>
> > If the code gets too complex, I either use more lines (if speed is
> important) or I create a procedure.
>
The guys at Oberon microsystems published a set of Programming Conventions
for Oberon/L a.k.a. Component Pascal. It is included in the Help file with
the Blackbox Component Pascal system. Several possible styles i.e. multiple
statements on one line, statements split over several lines etc. are
considered to be good practice. Thankfully, nobody is forced or constrained
by the Oberon language itself (unlike some languages) to use a prescribed
programming style.
Rather than inventing our own programming conventions, we adopted those,
with the kind permission of Oberon microsystems, for the Astrobe development
system. If you do not have access to the original Blackbox document refer to
Chapter 8. 'Programming Conventions and Guidelines' in the 'ARM Cortex-M
Oberon Programmers Guide' which you can download from:
https://www.astrobe.com/Oberon.htm
When I'm writing new code from scratch then I use my own personal
preferences (which can change from one month to another!) However, if I am
making minor modifications to existing code I try to follow the principle of
'when in Rome do as the Romans do' and adopt a similar style to the original
author. If these principles are not followed the result can be code that
looks as ugly as a one-page document written in 17 different fonts.
Regards,
Chris Burrows
CFB Software
https://www.astrobe.com
More information about the Oberon
mailing list