Thoughts about Functions, Pseudocode & Natural Language

Richmond richmondmathewson at gmail.com
Sat Sep 12 04:24:34 EDT 2015


Last night I was reading "C++ How to Program" from 1998, for no better 
reason than that I had left my novel
at work . . .

Oddly enough bits of it proved thought-provoking:

"During the 1960s, it became clear that the indiscriminate use of 
transfers of control was the root of much
difficulty experienced by software development groups."

"The notion of so-called /structured programming/ became almost 
synonymous with "/*goto* elimination/."
The research of Bohm and Jacopini had demonstrated that programs could 
be written without any *goto* statements."

[Which is rather odd as from 1975 to 1985 all my programming seemed to 
revolve round subroutines.]

When I read this I thought of a *function* in LIveCode, and thought that 
a *function* was a /transfer of control/.

The authors of this book don't actually bother to explain why /transfer 
of control/ is supposed to be a bad thing.

But they do say this:

"structured programs are clearer, easier to debug and modify, and more 
likely to be bug-free in the first place."

I actually find that statement pretty contentious. Particularly "more 
likely to be bug-free in the first place." The authors
do not give examples and explanations as to why this might be true.

The other thing is that programs written without transfers of control 
would seem to necessitate the needless *repetition*
of code-blocks that, if hived-off into a *function*, can be written 
once, and control can be transferred to them when and
if that functionality is required.

Certainly calling a *function* in *LiveCode* seems no different from 
using a *goto* or *gosub* statement.

----------------------------------------------------------------------

Further on I came across this:

"Pseudocode is often used to "think out" a program during the program 
design purpose.
The the pseudocode is converted to C++."

And it occurred to me that *LiveCode scripting* is considerably nearer 
to what these authors call 'pseudocode' than C++ is,
and wondered if:

The closer a programming language approximates to pseudocode the easier 
it becomes to use.

At which point I started wondering if LiveCode, from its starting point 
in HyperCard and MetaCard hadn't, subsequently,
moved further away from the pseudocode 'ideal' and further towards a 
more 'traditional' programming language with,
as it has become more sophisticated and powerful, the introduction of 
stuff that looks less like natural language and
more like a computer language?

----------------------------------------------------------------------

Certainly, from the point of view of teaching LiveCode to school 
children, the closer LiveCode is to both English and
'pseudocode' the easier the job that is involved turns out to be.

Richmond.



More information about the Use-livecode mailing list