Computer Science Canada Is functional programming difficult to learn/teach? |
Author: | wtd [ Fri Dec 30, 2005 5:54 pm ] |
Post subject: | Is functional programming difficult to learn/teach? |
Thoughts? I'll post mine after I've gotten some input from others. |
Author: | rizzix [ Sat Dec 31, 2005 12:42 am ] |
Post subject: | |
Hmm... I think it would be impossible, if the student hates math. It feels too math-ish. On the othe hand if the student loves math.. this is going to be a breeze. |
Author: | wtd [ Sat Dec 31, 2005 1:26 am ] |
Post subject: | |
Of course, this is really two questions. What's the answer for complete novices, and what's the answer for students who've gotten used to a different way of thinking about programming. |
Author: | Cervantes [ Sat Dec 31, 2005 10:47 am ] |
Post subject: | |
Novies: If it's a bright class, it might work. Too bad AP CompSci classes are so few and far between. Students who are used to a different way of programming: Again, it depends on the individual. If the individual is open to new ideas, it should be fine. If the individual is more stubborn, stuck in their ways, and generally does not like learning, then there would definately be problems. |
Author: | MysticVegeta [ Sat Dec 31, 2005 12:43 pm ] |
Post subject: | |
I gotta tell ya people though, when I learned fcns/iterations in grade 9, its wasnt difficult at all, I didnt find it difficult. So my first exp with fcns was in programming rather than math, then in the summer vacation, I thought lets see if the Math fcns resemble the programming ones, they are actually quite similar. In grade 10 when our teacher taught us the unit on fcns, I skimmed through it because I already had a good exp. with fcnal programming that I found it easy besides I had already learned the math ones before... Overall, I would say, it depends on your teacher and your self learning skills. If the student has tackled fcns or fcnal programming on his "own" before he was even taught, it would be really helpful for him but if not then it might get a little confusing but I don't see why its that hard.. |
Author: | Cervantes [ Sat Dec 31, 2005 5:42 pm ] |
Post subject: | |
Subroutines that return values is not the discussion here. The discussion is functional programming as a classification, like imperative programming or object-oriented programming. Haskell is a functional language. O'Caml is partly functional. |
Author: | wtd [ Sat Dec 31, 2005 5:44 pm ] |
Post subject: | |
Cervantes wrote: Subroutines that return values is not the discussion here. The discussion is functional programming as a classification, like imperative programming or object-oriented programming. Haskell is a functional language. O'Caml is partly functional.
O'Caml is functional, and not just partly so. It would be more correct to say that it's impurely functional, since functions can have side-effects. |
Author: | MysticVegeta [ Sun Jan 01, 2006 12:58 am ] |
Post subject: | |
Cervantes wrote: Subroutines that return values is not the discussion here. The discussion is functional programming as a classification, like imperative programming or object-oriented programming. Haskell is a functional language. O'Caml is partly functional.
OOP such as turing like and imperative as in others? |
Author: | [Gandalf] [ Sun Jan 01, 2006 1:25 am ] |
Post subject: | |
No, OOP like Java and imperative like Ada. If I am not mistaken, what you were referring to previously would not be functional programming, but procedural programming. |
Author: | Cervantes [ Sun Jan 01, 2006 11:27 am ] |
Post subject: | |
[Gandalf] wrote: No, OOP like Java
We can do better. Smalltalk, Ruby... Io. Though Io is a little different, in that it uses Prototype-based programming. Rather than writing classes, we clone objects. |
Author: | MysticVegeta [ Sun Jan 01, 2006 12:45 pm ] |
Post subject: | |
Isnt turing object oriented :S |
Author: | Cervantes [ Sun Jan 01, 2006 1:05 pm ] | ||
Post subject: | |||
Don't let the name, OOT, fool you. Turing is very weakly object-oriented. You can write classes and create objects, but its capabilities in this realm are quite limited. Though it may have some object capabilities, it is certainly not object-oriented. Take a look at Ruby, a language that is truly oriented around objects: it has OOP built into it from the ground up. Everything in Ruby is an object, even fixed numbers, like 5.6.
Instead of calling a round method from a Math module, we call the round method on the object, 5.6. Uh.. to return to the topic, what are your thoughts, wtd? |
Author: | wtd [ Sun Jan 01, 2006 1:43 pm ] |
Post subject: | |
My thoughts, eh? You're doing a wonderful job. The first step in answering this question, I think, is to understand what a functional programming language is. |
Author: | MysticVegeta [ Sun Jan 01, 2006 4:29 pm ] | ||
Post subject: | |||
Cervantes wrote: Don't let the name, OOT, fool you. Turing is very weakly object-oriented. You can write classes and create objects, but its capabilities in this realm are quite limited. Though it may have some object capabilities, it is certainly not object-oriented.
Take a look at Ruby, a language that is truly oriented around objects: it has OOP built into it from the ground up. Everything in Ruby is an object, even fixed numbers, like 5.6.
Instead of calling a round method from a Math module, we call the round method on the object, 5.6. Uh.. to return to the topic, what are your thoughts, wtd? ouch the name OOT fooled me So isn't it illegal for them to call their lang OO if its only partly OO..? |
Author: | wtd [ Sun Jan 01, 2006 4:58 pm ] |
Post subject: | |
It technically does provide the ability to program in an object-oriented manner. It does just about everything possible to discourage it, though. Turing was designed to supplant Pascal. Pascal has no meaningful standard way of doing object-oriented programming. You can see, therefore, how it would not be a priority. I suspect those features were tacked on so they could say the language was object-oriented and fend off Java for a bit until they convinced schools to go with RTP for Java classes. |
Author: | Drakain Zeil [ Mon Jan 02, 2006 10:51 am ] |
Post subject: | |
I would say it depends on the person's background knowledge. For example, explaining a programming function is much easier if you have a background knowledge of things like... f(x)=20x+x/10 g(x)=10 h(x)=109*f(x)/g(x) ...for example. Chances are, if you know what those mean, and can easily make use of them, you'll be better capable of understanding how functions work (even ones with more than one argument, since that concept is easily transferable). However, if the sight of those compleatly flabergast you, you would have a harder time understanding it. |
Author: | wtd [ Mon Jan 02, 2006 2:04 pm ] |
Post subject: | |
Well, it also depends on how you explain functions to students. Are functions names for some place in memory that you can execute, optionally pushing arguments onto the stack which can be popped off and used? Well, of course it is. But... is that how you explain it? Or, do you explain that a function is a relationship which maps its arguments onto a new value, and may be implemented as mentioned above? |