I'm not a great programmer. Instead, I'm a good programmer who has two solid skills which make me valuable. I consider the business needs of my code and I can explain things well. The latter point, though, is bugging me right now.
Sometimes my non-programmer friends ask me about programming. I usually don't go into too much detail because watching them fall asleep over a beer is never fun. Every once in a while, though, they start to grill me about what it is that I actually do. Sometimes the concept of "programming paradigms" is discussed. I really have no problem describing to my friends what imperative, objective, and logical programming are. But what about functional programming? I think I understand it. I have a pretty good grasp of the basics and use functional techniques when I think they're appropriate, but how do I describe it in such a way that the average person would understand. I'm stumped.
I've learned a long time ago that if I can't describe things in simple terms, there's a good chance that I don't really understand what those things are. How would one explain functional programming to a non-programmer? Particularly, how would one explain this in an unambiguous fashion which doesn't lead to the question "how is that different from 'X'"?
Re:An explanation I'm waiting to try out...
chromatic on 2006-05-27T15:41:43
That's pretty good. It's a lot like what I planned to write.
Re:An explanation I'm waiting to try out...
Alias on 2006-05-28T08:35:31
On a side note, my basis for that is how I learned Objects and Closures.
First I learned imperative, which I think is the best, since "do this, do that, take this number and blah" makes sense to people.
Then I learned about namespaces, which makes sense, because of course you want to have function names and variable names that are seperated from each other.
The Objects are "when you bless a bit of data, it magically knows where the functions for it are".
And once you get objects, closures are much easier, because then "If an object is a variable that magically knows where its functions are, a closure is a function that magically knows where its variables are"
And from there, a continuation is "Like a closure, but as well as the variables it also remembers the call stack, which is what you see with caller()"
That's a very summarised version of the path I took learning Perl.
As for functional programming, from what I see of Haskell so far, it's kind of nutso. But then hey, it's a mathematician's language.
Audrey's talk teaches is in about the best order I've seen so far.And monads ? :)
rafael on 2006-05-28T21:50:24
For functional programming, I also speak of time. Imperative programming relies on time: do this, then do that. Then, your data changes, and where there's changes, there's flow of time.In functional programming, take away the data, then time disappears automatically: like in a mathematical formula, or a set of formulas. [With this additional remark, you can even hint at what are monads, as in "where time reappears, because some input is added to your program". Not a very accurate description, but a sufficient one for that purpose.]