On Thu, 31 Mar 2005, John L. Ries wrote:
On Thu, 31 Mar 2005, John Ollason wrote:
My main reason for asking the question was to try to find out if there would be any interest in a modern primer, based on GPC, as an introduction to scientific programming. Years ago, with a colleague, we talked of writing a book entitled 'Brute force programming' which was designed for scientists.
...snip...
Having worked with a fair number of statisticians (I work for one), I've seen more than my share of brute-force programming, though the bulk of it seems to be written in Fortran 77 (being from a CS background, I like my code to be neat and tidy, though I've become more pragmatic over the years). Seems to me that teaching Pascal to engineers, scientists, etc. couldn't possibly be a bad idea (does a lot more than f77 and is much safer than C) and the brute-force approach does have advantages, as long as it's not taken to an extreme (I once rewrote a huge compound if-then-else block running to hundreds of lines as a FOR loop of about 20 lines of code). In Pascal, the brute-force code can at least be written a little more succinctly.
You should, however, make mention of the fact that quick-and-dirty programs sometimes take on a life of their own; in other words, the brute-force code you wrote might be applicable more often than you realized and you might be forced to maintain it.
I wasn't thinking of really brutal programming, rather avoiding the subtleties of deciding which sorting algorithm to use if you want to sort a list of 200 numbers once. My colleague, the other brute force programmer, only started to become interested in programming when the first micros, with BASIC interpreters, appeared. He transferred from micros to the university mainframe and on one occasion used up his entire allocation of resources using his self-discovered bubblesort on a truly vast array of data. I showed him the Shellsort algorithm and the array was sorted in a very short time. So perhaps the book ought to be entitled 'Modestly brute force programming'.
The maintenance issue is one which makes Pascal, in my view, an outstanding programming language. I became interested in a problem to do with the distribution of foraging animals in a heterogeneous environment in the early '80s, published a paper on the subject, and lost interest in the problem, but around 2000, I returned to the problem, returned to the programs I had written 20 years before and could still understand and run them, and indeed used them as the foundation for the programs used in the research that revisited the problem. The only modification that was needed was to the file connexion procedure that connected internal Pascal files to the outside world, this despite the change of hardware from a Honeywell big iron machine, to Sun Pascal, to GPC, by courtesy of ISO Pascal.
John O.