What IS a Function, Anyway?
Function.
The word has given not just new coders wrinkled brows and vacant stares, but also most everyone who encounters the term initially. Though we programmers might tend to think "function" only applies to us, in reality it crosses every boundary and therefore I believe that NOBODY should live one moment longer without being armed with a precise understanding of it. Here's what got me thinking about it...
Today as we were driving my step daughter home from school, I asked her what she was doing in math these days and she told me they were working with functions. It immediately brought to mind my first foray into Calculus taught by Mr. Musgrave, when "Eff of X" was a phrase I heard constantly yet was NEVER given the understanding of. Every single day I struggled to wrap my mind around what a function really was, what "Eff of X" was really saying, and never managed to until just a few years ago (hence I hobbled by with a mere C in that class). Now that I'm older and wiser, the term is no longer foreign to me and in fact is second nature, as I finally connected the dots between Calculus functions, Javascript functions, Coldfusion functions, and even the functions that occur in nature. What follows is my personal definition of what a function is, accompanied (as usual) by a colorful and simplistic analogy to help illustrate.
The Definition: A function receives something into itself, performs some kind of work on whatever the input was, and spits the results of that work back out. Period.
It can be a math function that accepts a value 'x', plugs it into some equation, and then returns the mathematical result; it can be a programmatic function that receives something into it...be it a numeric value, a string of text, an object, etc....and returns the results of the code it was told to execute. Ah, and here's the clincher, the missing link that will help ANYBODY, I mean even your TODDLER, to completely understand what a FUNCTION is:
Even your own BODY is a function! You give it some kind of input...let's say, a peanut butter sandwich. Your body performs some kind of WORK on that input (in our case, digestion), and VOILA! You get some output. In this case, a turd.
There is absolutely NO difference whatsoever between a calculus function, a programmatic function, the Human function, or even the myriad of individual functions that work in harmony within our own ecosystem. A function receives something in, performs some work on it, and gives something back.
Pass this tidbit on to everyone you know, even and especially your kids, so that perhaps when they too first encounter Mr. Musgrave's endless repitition of "Eff of X, boys and girls, EFF OF X!", they can avoid the mental anguish of trying to grasp something so simple and common sense, yet perpetuated (for some odd reason) as being so deep and abstract.
And now, if you choose to accept, your Assignment:
Find the nearest individual who you think would be least likely to understand what a function is (young or old), take two minutes to teach them the concept using their own body, their Play Doh Fuzzy Pumper Number 9, the oven, or anything else you can think of that they can relate to, and see if their retention of the definition isn't 100% every time you ask them thereafter.
Doug out :0)
The word has given not just new coders wrinkled brows and vacant stares, but also most everyone who encounters the term initially. Though we programmers might tend to think "function" only applies to us, in reality it crosses every boundary and therefore I believe that NOBODY should live one moment longer without being armed with a precise understanding of it. Here's what got me thinking about it...
Today as we were driving my step daughter home from school, I asked her what she was doing in math these days and she told me they were working with functions. It immediately brought to mind my first foray into Calculus taught by Mr. Musgrave, when "Eff of X" was a phrase I heard constantly yet was NEVER given the understanding of. Every single day I struggled to wrap my mind around what a function really was, what "Eff of X" was really saying, and never managed to until just a few years ago (hence I hobbled by with a mere C in that class). Now that I'm older and wiser, the term is no longer foreign to me and in fact is second nature, as I finally connected the dots between Calculus functions, Javascript functions, Coldfusion functions, and even the functions that occur in nature. What follows is my personal definition of what a function is, accompanied (as usual) by a colorful and simplistic analogy to help illustrate.
The Definition: A function receives something into itself, performs some kind of work on whatever the input was, and spits the results of that work back out. Period.
It can be a math function that accepts a value 'x', plugs it into some equation, and then returns the mathematical result; it can be a programmatic function that receives something into it...be it a numeric value, a string of text, an object, etc....and returns the results of the code it was told to execute. Ah, and here's the clincher, the missing link that will help ANYBODY, I mean even your TODDLER, to completely understand what a FUNCTION is:
Even your own BODY is a function! You give it some kind of input...let's say, a peanut butter sandwich. Your body performs some kind of WORK on that input (in our case, digestion), and VOILA! You get some output. In this case, a turd.
There is absolutely NO difference whatsoever between a calculus function, a programmatic function, the Human function, or even the myriad of individual functions that work in harmony within our own ecosystem. A function receives something in, performs some work on it, and gives something back.
Pass this tidbit on to everyone you know, even and especially your kids, so that perhaps when they too first encounter Mr. Musgrave's endless repitition of "Eff of X, boys and girls, EFF OF X!", they can avoid the mental anguish of trying to grasp something so simple and common sense, yet perpetuated (for some odd reason) as being so deep and abstract.
And now, if you choose to accept, your Assignment:
Find the nearest individual who you think would be least likely to understand what a function is (young or old), take two minutes to teach them the concept using their own body, their Play Doh Fuzzy Pumper Number 9, the oven, or anything else you can think of that they can relate to, and see if their retention of the definition isn't 100% every time you ask them thereafter.
Doug out :0)
Subscription Options
You are not logged in, so your subscription status for this entry is unknown. You can login or register here.
Re: What IS a Function, Anyway?
That's nice... Not sure mathematicians would agree with it, but I find your definition simple, elegant and, well, functional. By the way, Mr. Musgrave was obviously a lousy teacher.
Posted by Mattthew on July 23, 2008 at 5:52 PM

