Re: Mathematica daily WTF
- To: mathgroup at smc.vnet.net
- Subject: [mg115195] Re: Mathematica daily WTF
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 4 Jan 2011 04:23:52 -0500 (EST)
On 1/3/11 at 9:11 AM, btreat1 at austin.rr.com (DrMajorBob) wrote: >Procedural code can be written particularly badly... and so can >functional code. >For elegance, efficiency, and readability, both depend on a good >programmer's consistent style. >Functional code, in addition, needs good names for its functions. Certainly, this is all true. But even with well written code, I find functional code easier to understand than procedural code. If I write f[x], it is immediately apparent the result is a function f with argument x regardless of what function f is. If I write the procedural equivalent it is often far less obvious as to what is being done particularly if the procedural equivalent involves nested For loops. In another post in this thread Andrzej described functional code as being like a box with an input and output and procedural code as being something corresponds much closer to what the computer actually does. To me, this is the essence of the difference in understanding both styles (assuming well written code). With functional code, it is easier to see the "big picture" of what is happening while the details are often obscured. With procedural code, the details are much more apparent but it takes something more to get the "big picture". To me, understanding the purpose of code means getting the "big picture" and is not in the details.