[Edu-sig] Re: explaining functions [Possibly OT]
Toby Donaldson
tjd at sfu.ca
Mon Dec 6 06:01:01 CET 2004
I've always thought of the mathematical and programming notions of
functions to be very different things. The problem with the mathematical
definition of a function is that it is that it isn't broad enough, e.g.
it says nothing about side-effects like printing, making a sound, or
reading/writing a file, etc.
So I think defining functions as "black boxes" or little machines is the
way to go ... I think it's a mistake to explain Python functions as
being the same sort of thing as mathematical functions.
My experience is that the average student usually has no trouble
understanding how to use a function. They grasp the mechanics pretty
quickly from examples. Issues such as the difference between printing a
result and returning a result are confusing to some, as are issues such
as scope. But you don't need to have a perfect understanding of such
things to use functions effectively.
By far the biggest difficulty I've seen students have is deciding how
and when to make their own functions. This is exacerbated by the fact
that in beginning programming you typically only write small programs
where writing your own functions might not be useful.
Toby
>Hi all,
>
>This might be a bit tangential to the topic; if so, my apologies. (I've
>been reading this list for a while, but have never posted before.)
>
>I'm a Python hobbyist, and am not involved in CS education, except
>peripherally. I am also a grad student in Philosophy who has, for a few
>years now, been teaching Introduction to Formal Logic to audiences
>largely composed of Philosophy and Linguistics undergrads with a small
>contingent of Computer Science undergraduates, too.
>
>I have found it difficult to get some of the humanities undergraduates
>to see the understand the general mathematical concept of a function.
>Occasionally, even some of the CS students (who, when I see them, have
>just begun) stumble with the concept, too.
>
>The best I have managed to come up with is to tell them that a function
>is like a 'black box' to which you feed some ordered input of the
>appropriate sort, and it gives you an output determined entirely by that
>input.
>
>I have found that, at least for the humanities students, getting them to
>understand some of the material is largely a matter of finding a useful
>metaphor (and, convincing them that the metaphor is an aid, not the
>thing in itself). That's been the only way to get the ones bothered by
>the mathematician's use of "if ... then ..." to accept it. (They don't
>like that "If 2 + 2 = 97 then I am King of the moon" and "If grass is
>green then sky is blue" are taken to be true.)
>
>So, I am wondering if others on the list have had difficulty getting
>students (particularly students not primarily studying Math or CS) to
>get the idea of a function? If so, I'd be very interested in what
>techniques were of use.
>
>Thanks, and I do apologize if this query is received as too peripherally
>related to the topic of the list. Best to all,
>
>Brian vdB
>
>
More information about the Edu-sig
mailing list