From: fateman@peoplesparc.Berkeley.EDU (Richard Fateman)
Newsgroups: sci.math.symbolic
Subject: Re: The Real Meaning of Efficiency?  (Re: Serious Programming, etc.)
Date: 20 Nov 1992 17:48:47 GMT
Organization: University of California, Berkeley
NNTP-Posting-Host: peoplesparc.berkeley.edu

In article <By0q94.9p9@news.cso.uiuc.edu> Richard J. Gaylord <gaylord@ux1.cso.uiuc.edu> writes:


>recursion is said to be a powerful tool but it is almost never used. why?
>one reason, of course,  is that the old FORTRAN didn't support recursion. 

Another reason is that most people are unable to think about it 
without some training.  That's why it is taught in CS classes.
Mathematical Induction is said to be a powerful tool but it is almost
never used. That's why it is taught in mathematics (and CS) classes.

digression:  The split program was an example of induction that translated
into recursion. You couldn't write it that way in Mathematica without
losing big on efficiency. It would look Something like this..

Split[{},n_]:={}  (* base case *)
Split[lis_,n_]:=MakeANewListOf[FirstNElementsOf[lis,First[n]],
                               Split[ElementsAfterFirstN[lis,First[n]],
                                     Rest[n]]
undigression.

At Berkeley, we haven't taught Fortran in CS for many (20) years.  There
is a Fortran intro course in engineering, taught by engineering faculty.
But the main upper division scientific computing for engineers course
is taught using Matlab, although there is some (I think) fortran. Maybe
sometime they will use a CAS too. Working engineers may have to make
many sacrifices to get the job done.  We try to show them better
approaches that might help them during the 40+ years of their career.
We are not a vocational school. They can learn fortran in 1 week, and
they can become expert at it in 3-6 months. This is not important CS stuff.

The fact of the matter is that many non-CS scientists think that CS courses
"teach programming languages".  This is (or should be) false.  We should
be teaching ideas about algorithms, data structures, organization of
programs (correctness, etc). The nature of the artifacts (e.g. current
instruction sets, dialects of programming languages) are incidental, but
we teach some of that too.

I have heard it said at a major US gov't laboratory that the difference
between physicists and computer scientists is that the computer
scientists know no physics.  Although this is is initially amusing,
it is actually a truthful indication of the sad state of computing in
physics.  Do you really want your students to get jobs where they
can worry about someone else's COMMON statements,
and submit their revisions of programs as"card deck images" --- and
not know that there is something better???

>Its totally clear that most cs departments don't have
>the faintest idea what non-cs people want or need to know about
>programming. 

I agree on this.

>This can be seen from the recent move at many places from
>FORTRAN to C as the first language. 

False, at least for my department.  We don't teach C first, and we certainly
don't push C as a language for scientific computing. We introduce Scheme
first as a way of conveying important ideas in COMPUTING.

>it has been said that you shouldn't teach programming with mathematica
>because its a bizarre and inconsistent language...

I'll agree with whoever said that.

... and if you learn
>mathematica programming it will ruin your ability to learn how to program
>properly. 

I doubt that.  But I've heard this said about BASIC, and FORTRAN too. The
human mind is sufficiently flexible that bad habits can be unlearned.


>the best thing that could happen to the teaching of programming to tech
>people would be to use mathematica to do it.

I disagree strongly.  You may think this is a religious argument, but
here are my justifications, in brief:

Try to explain the concept of a linked list in Mathematica.  Try to
explain why O(n log n) sorting algorithms take O(n^3). Try to explain that
a/b and 1/2 are different data structures.  
Try to explain why x:=(x+x)/2 increases the accuracy of x, but
that x:= 2*x-x decreases it.  (but only in versions < 2.0) .

If you want your students to believe that computers are magic,
although sometimes unreliable, then Mathematica is your language!

>
>finally, the comment about the use ofthe 'claptrap' of anonymous
>functions to avoid pattern matching is total claptrap (which according to
>the dictionary means  pretentious nonsense). i write almost all of my
>programs using anonymous functions because i use a functional programming
>style which is very natural to me. others  prefer to program using 
>pattern matching (which is far more sophisticated in mathematica than in
>most other languages). the ability to choose the style most appropriate
>to the problem and to the way in which the programmer thinks is one of
>the most important features of mathematica.

Thanks for looking up claptrap.


> hopefully, this thread will have ended by the time i return from my
>thanksgiving hoiday.

I doubt it. Enjoy your turkey..



-- 
Richard J. Fateman
fateman@cs.berkeley.edu   510 642-1879