Re: Functional Programming in the Larger or Functional Oriented Software Engineering
Michael Naunton <[email protected]> Sun, 18 Mar 2007 13:20:02 -0500
| Newsgroups | gmane.comp.lang.lightweight |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 2007-03-18 at 17:34 +0100, Pascal Costanza wrote: > > I see two possible reasons: > > > - Functional programming seems to require more abstract thinking than > object-oriented programming. Objects seem to be more tangible than > functions. The idea of presumably better being able to model the "real > world" is related, because I guess a simplified physicality of the > "real world" is implicitly assumed here. (I don't understand what > "modeling the real world" is actually supposed to mean. I don't think > this idea makes any sense. But that's a different topic... ;) Well, weaker thinkers certainly seem to have more success in o-o rather than functional systems. Perhaps functional systems are therefore superior because they prevent poor programmers from "fouling the pool." Just pray no one ever writes Design Patterns for functional programming. "modeling the real world" has always seemed simple to me: someone is paying the bills (a corporation, a professor, etc) and is emphasizing certain elements of reality that need to be modeled (otherwise we would all be programming quantum particles.) We try to create elegant models in that specific domain. E.g. my current project is maybe 30% modeling and implementing reality, 70% dealing with the 100+ years of cruft that has grown up around the basic problem. > - Functional programming doesn't scale very well. Function composition > seems to be very straightforward because it allows you to take two > functions and combine them into one. However, as soon as functions are > defined recursively by calling themselves, function composition > doesn't work that well anymore. Consider: > > > (define (fac x) > (if (= x 0) 1 (* x (fac (- x 1))))) > > > There is no straightforward way to compose fac with another function > in a way such that the recursive call inside fac to itself gets > redirected to the composite function. Wait, wait! I just read your paper on layers. You practically have this solved. -- Michael