4 ms·
This is awesome - I just started looking for something like this, for my kid. Having taught programming before, one thing that many people find confusing at fi
by beagle3 7y ago
This is awesome - I just started looking for something like this, for my kid.
Having taught programming before, one thing that many people find confusing at first is using "=" for both assignment and equality; statements like "x = x + 1" make no sense as a math equation.
I think supporting (but not requiring) "let" (or equivalently "make" or "set") helps go over that hump, although I last taught basic to someone 30 years ago... e.g., if you accept
let a = 3
or
make a = 3
makes it a little easier to grok
let x = x + 1
(although the x on the left is "now" and the x on the right is "before"). Alternatively, using something like "x <- x + 1" is much clearer, and just as clear for "x <- 3" (especially with a right font or glyph). Unfortunately, there is no single ascii character/glyph that intuitively conveys assignment; K uses ':' which is ok, Pascal uses ':=', neither of which is good for Basic and the like, I think.
- chkas 7y agoThe assignment with a "let" would probably be really easier to understand. On the other hand, in most programming languages today, assignment is done with the "equal" symbol. This makes the code less noisy. Since the comparison operator is only used for "while" or "if", the risk of confusion is not so great.
- beagle3 7y agoMost definitely agree - once you get over it, it's not confusing it all. But statements such as "x = x + 1" ARE confusing to newcomers, from my experience. Essentially all Basic interpreters in the 80s accepted "let" to start assignment, but did not require it. Some (e.g. ZX Spectrum Basic) did require it.
- K0SM0S 7y agoYes, the problem is not that a seasoned practitioner cannot internalize just about any quirk, typically historical. The problem is that a first-time learner already has their mind full with information (we can only ever hold ~7 items in working memory, cognitively, so make sure each one counts when teaching anything).
- beagle3 7y agoThis reasoning taken a little farther would say that APl is by far the cognitively easiest language, which is demonstrably false. Also, it is unrelated to what I said - namely that “let” disambiguates the two meanings of the equal sign, which from my (and not just my) experience is a heavy cognitive load on people new to programming.
- K0SM0S 7y agoI was replying to this specific part, which I should have quoted. Sorry. > But statements such as "x = x + 1" ARE confusing to newcomers, from my experience Merely elaborating. Indeed, `let` does reduce cognitive load, it's one less "new thing" to keep in working memory¹ (this is the specific part of human cognition that we use to reason directly, "human RAM" for lack of a better term). I'm not sure how it's unrelated... nevermind. I got misunderstood in my comments all day, must be Venus. :) ____ 1: https://en.wikipedia.org/wiki/Working_memory https://en.wikipedia.org/wiki/Working_memory ____ Edit: I fail to see why this: > This reasoning taken a little farther would say that APl is by far the cognitively easiest language, which is demonstrably false. Could you explain?
- beagle3 7y agoSorry, I thought you were implying "let" would be one more thing to remember (taking one of the ~7 slots), and that's why we SHOULDN'T use it. > APL is by far the cognitively easiest language, which is demonstrably false. (that was a lower case L typing on phone, sorrt). APL code is incredibly short - 7 APL chars are usually equivalent to 50-100 in other languages. One would expect that would make it easy to master & read, but experience from the last 60 years or so shows that's not true.
- K0SM0S 7y agoAh, fair enough. Re-reading my comment, I once more failed to remove ambiguity. My bad. For clarity, we SHOULD use `let` with beginners, and any such pre-existing concept whenever possible. There's a time to reinvent some wheels I guess, but while first learning to drive certainly isn't it. APL, haha gotcha. Way to zero-in on the edgest perfect case! It indubitably shows how a "short" form is not necessarily cognitively "light", which has everything to do with familiarity in my book— a sizeable body of knowledge already internalized, already abstracted into a symbol or form— e.g. "let x", or a function whatever the abbreviation, the logical construct if... then... else, etc. Indeed should I speak to you in "objects you know" as a basis for language, chances are translation is possible between my ideas and those fundamental bricks of yours— some arragement thereof, that encodes whatever I want to convey. This is where/how actual pedagogy begins for me (totally layman perception, no formal training whatsoever). But failing the basic math background, these concepts fall back one-step removed from cognitive ease. I find it's extremely useful to speak in whatever domain language fits the student's background. Meet them halfway there so to speak, if I can help it.
- unwind 7y agoAs a C programmer, the idea that comparisons are only made in loops or ifs is very alien. Something like const bool press = (evt->flags & EVT_FLAG_PRESS) != 0; is common, idiomatic and nice in my world (for some made-up key event handler).
- userbinator 7y agoI deal with similar code, although for me, "!= 0" is usually discouraged; I would just use the result of & in a condition later, or if it must be turned into 0 and 1, the "booleanise" operator: const bool press = !!(evt->flags & EVT_FLAG_PRESS);
- chkas 7y agoThere is no boolean data type in easylang, so it is only needed in conditions.
- jecel 7y agoActually, the original ASCII proposal did include an up arrow and a left arrow. The final version a few years later replaced these with ^ and _ respectively. Some companies adopted the original ASCII. When Smalltalk-80 was developed it replaced its own quirky character set with ASCII but used the up arrow to indicate return and left arrow assignment. This made Squeak Smalltalk code look wrong, like "x _ x + 1", depending on the font you used and some people wanted to allow underscores in identifiers to make it easier to interface to other languages. So "x := x + 1" was added as an option and there have been some crusades to convert all older code to that.
- rdtsc 7y agoInteresting, I wonder how teaching Erlang would work for beginners that had only exposure to basic algebra and not other programming languages. There variables are immutable so X=X+1. shows an error as expected. It is dynamically typed so don’t have to introduce types right of the bat. I remember struggling with recursion at first but perhaps I was already so used to for loops from traditional programming. I suspect fundamentally it is actually simpler.