Hacker News new | ask | show | jobs
by las_cases 4102 days ago
> She completely misunderstood how functions and function invocation work.

How can that be? I remember learning about functions such as f(x) = ax + b in the fifth grade if I am not mistaken and learning about functions in programming was extremely natural. I studied programming in high school taken from the very basic and nobody had troubles with how functions worked. It was so math like that it was simply a non-issue. I am really interested to understand what the problem was and how did she figure it out eventually.

> And his way of teaching boolean logic is to memorize truth tables

But isn't Boolean algebra based on exactly that? Isn't this the pillar field covered by the mathematical logic, how can it be wrong?

2 comments

She understands function on a theoretical level. But keep in mind, she knows nothing about the cpu and jump commands. So, there was no intuition about functions being pieces of code being stashed somewhere for later use. That the interpreter would read a call and jump to that piece of code and send arguments to it. Instead, she developed her own theory of the interpreter reading a function definition and searching for calls in the code. The book did nothing to develop a healthy intuition about the flow of the program.

From the book:

> Learning logic has to come after you do some memorization. I want you to do this exercise for an entire week. (http://learnpythonthehardway.org/book/ex27.html)

Why would you need to memorize that not true == false? All of the others can be deduced by simple reasoning. One example:

    not (True and False)
    True and False is False
    not (False) is True
Instead of teaching people this (basic algebra), he recommends spending a week memorizing stupid tables?

The same thing with spending first ten chapters having people write print statements with convoluted string interpolations. String interpolation is a hard concept to grasp for beginners. Unpacking variables before learning about objects, introducing what he calls "commands" like raw_input(), before even mentioning functions. I could go on and on.

I see what you're getting at, but when you're talking about a high-level language like Python your comments about the CPU and jump commands seem really off-topic. You don't need to know anything CPU instructions or memory management to write competent Python (because that's all handled automatically) and knowing about them doesn't necessarily help you have a better intuitive understanding of Python code (because again, lots of stuff is happening under the hood automatically).
No, operators have English names resembling their semantics for that reason. AND(x, y) is only true if x and y are true. OR(x, y) is only true if x or y is true (inclusive). Etc.

If you're just going to remember truth tables, throw those names to the wind. You might as well call them P and Q. But we don't, because OR and AND and XOR make sense.

It looks like he introduces these truth tables (sec 27), where, to be fair, he does say this:

> The terms (and, or, not) actually work the way you expect them to, just like in English.

And then he asks you to practice memorizing the tables until you know them intuitively.