[Oberon] Use of resources.

John R. Strohm strohm at airmail.net
Wed Dec 16 04:24:15 CET 2015


I'll add this.

I'm 60 years old.  I've been in this crazy racket since before I turned 15.

In all that time, with a specific exception which I'll talk about in the 
next paragraph, I've seen EXACTLY one (1) procedure that NEEDED to be more 
than one printer page (about 66 lines) long, that could not have been 
profitably factored.  It was the photon torpedo routine from the 
Matuszek-Reynolds-McGehearty-Cohen STARTRK game.  Written in FORTRAN IV for 
the Control Data 6600, it essentially had to run a loop that simulated 
firing of up to three torpedoes, simulated the torpedo flyout, with random 
perturbations, checked for impact with various objects, and, in the case of 
impact on a star, simulated recursion with an explicit stack to compute 
8-way connectivity of star clusters, to nova all the affected stars.  It was 
about two pages of dense code, one statement per line, minimally commented. 
(It was assumed that the reader knew what was going on, and knew what he was 
doing.)

The exception is certain large finite-state automata with fairly sparse 
next-state matrices.  These tend to arise in automated test equipment 
scenarios, parsing "interesting" ad hoc communication sequences with the 
device under test.  I've never found a "good" way to factor or modularize 
these, and I've been looking, on and off, for over twenty years.

-----Original Message----- 
From: Chris Burrows
Sent: Tuesday, December 15, 2015 3:40 PM
To: 'ETH Oberon and related systems'
Subject: Re: [Oberon] Use of resources.

'One page per procedure' possibly but definitely not 'one page per module'.
I don't recall seeing a quote but I have always used a *rule of thumb* that
if you can't see all of a procedure at once then you should *consider*
refactoring it. Hence what might have been 'a page' in the past might now be
'a screenful'. This is deliberately vague e.g. if I regularly use one of my
widescreen monitors in portrait orientation with a relatively small font I
can see a lot more than otherwise might be posible.

However, you should be very careful when communicating guidelines of this
sort to inexperienced programmers to make sure they they don't interpret
them as commandments set in stone. Otherwise they might arbitrarily break up
large procedures into smaller illogical chunks just because they have been
given a rule to follow. You should give some examples of horror cases that
obviously need splitting up and other examples of procedures that are large
for a good reason (e.g. a case statement with many cases),

Regards,
Chris Burrows
http://www.cfbsoftware.com


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Frans-Pieter Vonck
> Sent: Wednesday, 16 December 2015 7:09 AM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] Use of resources.
>
> Hello Paul, Peter and all other oberonneurs,
>
> one of my former highschool students is writing a Python programmes
> that have very long listings. Despite the structured nature of Python
> his programmes become to complex to explain to me.
> Now I think I remember a quote from Niklaus Wirth where he states
> that every module that is longer than one page should be rewritten in
> separate modules.
> Did anyone remember this quote? And, do you think this adagium is
> only valid for the Main Module or is it also applicable for, say math
> library modules?
>
> Greets,
> Frans-Pieter
>


--
Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
https://lists.inf.ethz.ch/mailman/listinfo/oberon 


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the Oberon mailing list