Inflicting Haskell on N00bs for Science



  • Big difference between a typo, and genuinely not knowing how to use the words.

    But good catch.



  • It's the only way to get anything done in a purely fuctional language


  • With spoiler tags this flashes in and out of existence in mobile chrome. REALLY ANNOYING



  • @PJH said:

    Also: google("atretochoana eiselti");

    I'll see your atretochoana eiselti and raise you urechis unicinctus



  • @swayde said:

    REALLY ANNOYING

    form follows function



  • So, I just gave the Haskell test to my mother. She's almost completely computer illiterate, never even seen a programming language. She also doesn't speak English (just recognizes a few words), so I get a point over @Yamikuronue for are-you-fucking-serious-ness.

    sum(range(0, 10))
    

    She zeroed in on this one first.

    "There are 3 operations here, one after another. You take numbers from 1 to 10, then rank them, then summarize them."

    Interesting. She got that operations are executed in order determined by corners. Unfortunately, she missed the idea that (0, 10) are arguments for the range function. Also, her lack of English screwed her up - she interpreted "range" as "rank".

    But overall, afterwards we agreed this one was the most understandable of the bunch.

    foldr (+) 0 [1..10]
    

    She was completely lost here. "Elements 1 to 10, then add 0?"

    I decided to give her the Pascal code as an example of imperative programming, thinking greater verbosity might help her out.

    Sum := 0
    FOR i := 1 TO 10 DO
    BEGIN
        Sum := Sum + i;
    END;
    

    BIG mistake.

    You see, : is taught as symbol for division in Serbian schools. So she immediately zeroed in on that.

    "You divide sum with zero. Then divide one with 10. And divide Sum... I don't understand."

    I decided this is a wash, and pulled out my alternative. This same code in javascript.

    var sum = 0;
    for (var i = 0; i <= 10; i++) {
        sum = sum + i;
    }
    

    I made my second mistake here. I wrote down the for loop version instead of while, which is clearer.

    "Sum is equal to 0. Then, information is equal to 0, and at the same time, less then 10. And the information is then doubled. Then sum is equal to itself with added information... which is 0"

    Interesting. So, as that study speculated, the big conceptual leap is distinguishing assignment from equality.

    My conclusion is, it's a wash. Functional code can be clear if you massage it to look like English sentences (which you could do in Haskell, even if @Captain didn't). But it's not like you can't do the same thing in procedural code. All the obscure ='s and curly braces can be replaced with words, that would make code so much clearer for the noobs.

    It should also be pointed that there WAS a language designed to be "readable by the non-technical people". Its name was COBOL and, from what I hear, its "clarity" didn't exactly make it any easier to work in.

    I guess, as many different things, the secret is hitting a balance between readability and expressiveness. And given that there are a thousand different tastes and use cases, there won't be one super solution to solve them all.



  • @Bort said:

    Can we come up with a name for println/echo that an unfamiliar person would understand?

    Console.WriteLine



  • @TheCPUWizard said:

    Console.WriteLine

    "What's a console? You mean like a PlayStation?"



  • @Bort said:

    You mean like a PlayStation?"

    Close enough (think about it). Most people either play games on computers, even those who don't know that it can be done (the exception would be extremely rare).



  • @cartman82 said:

    It should also be pointed that there WAS a language designed to be "readable by the non-technical people". Its name was COBOL and, from what I hear, its "clarity" didn't exactly make it any easier to work in.

    Just one? Are we in a universe where HyperTalk/AppleScript never existed?



  • @TheCPUWizard said:

    Close enough (think about it). Most people either play games on computers, even those who don't know that it can be done (the exception would be extremely rare).

    Console is the worst computer term. It's a PIECE OF FURNITURE. You're naming a feature of your computer AFTER A PIECE OF FURNITURE.



  • @blakeyrat said:

    Console is the worst computer term. It's a PIECE OF FURNITURE. You're naming a feature of your computer AFTER A PIECE OF FURNITURE.

    And yet it has been in use for this purpose since at least the late 1950's.... about 60 years, and even longer as "the control unit of a mechanical, electrical, or electronic system" (I have found references over 100 year old for that meaning)



  • Because doing it wrong for a long time makes it automatically right?



  • @TheCPUWizard said:

    Console.WriteLine

    Is my computer sad? Why does it need consoling?
    Will it commit suicide if I don't write enough supportive messages?


  • Java Dev

    In naming stuff? Yes.


  • Discourse touched me in a no-no place

    @RaceProUK said:

    on an Australian beach, obviously

    Because people hang around in their underwear on Australian beaches?


  • FoxDev

    Bikinis are essentially fancy underwear, so yes 😛



  • @loopback0 said:

    Because people hang around in their underwear on Australian beaches?

    Yes, even our prime minister does it.
    [spoiler]

    [/spoiler]
    Though we wish he didn't.



  • @tarunik said:

    About the only thing that actually makes a difference for non-silly cases (because mixing tabs and spaces for indentation should make you feel bad to begin with) is that you have to write pass for a null statement in Python, but that's not too far off having to shove a ; or {} in there in C-style languages...
    I like Python and think I went into it with a very open mind about its whitespace sensitivity, and I don't understand the "why should whitespace carry semantic meaning??!?!11!?" argument, but I've come to have a small dislike of Python-style whitespace sensitivity. I find it is a little more obnoxious to edit, even with decent editor support. Because of the way the REPL reads things in (stopping at blank lines), you can't copy and paste a lot of code into it. (I think someone suggested eval(""" ... <pasted stuff> """) or something like that, which... I guess makes this a little less objectionable. And certain badly-behaved forum and mailing list software will eat whitespace and make Python code completely unintelligible. (That's the software's fault, but it's a problem that wouldn't arise without whitespace sensitivity.)



  • @xaade said:

    How can you say, "I want this to be my career, but I don't want to make any effort on my own to learn it".
    What if it never occurred to them that they might like it, but then they took a class or workshop or something?



  • This is why expressiveness matters.

    Having = for assignment is the problem.
    Not people's ability to be consistent. They are clearly guessing based on previous experience.

    This goes back to what I said before. People's ability to get the test right is their ability to forget everything.

    Imagine if the code looked like this

    Set X to Y;
    

    I might assume now that X and Y are the same object. So if you change X, you've changed Y.
    This comes from basic Algebra.

    Set X.Value to Y.Value;
    

    Now we have a new problem. This just doesn't make sense at all. If X.Value == 5 and Y.Value == 6, you're saying that 5 == 6. This could imply that you are changing the rules for math.

    Set X to Y.Value;
    

    Does that mean that the reference to X becomes Y's value? That won't work either.

    Now Y.Value == 5 and X == 5. So if you tried to access X, you'd get a MemoryViolation.

    So, assignment cannot be deduced logically.

    I think this works better.

    X.Value becomes Y.Value; // value assignment.
    
    X becomes Y; // reference assignment.
    

    I think that language is more explicit.


    This is why I think it is a problem with how we express programming as a language, and how we teach it. And not whether people can learn it.

    Basically we created something that isn't just meaningless, it's nonsensical altogether.


    X = 5, makes sense.
    Y = 10, makes sense.
    X = Y, makes no sense, no matter how you approach it.

    The only reason I understood it, is because I already knew that computers had memory and that variables are containers for values and not values themselves.

    Algebra teaches us that variables represent values.

    Programming teaches us that variables contain values, and that you can change what's in the container by giving it a value from another container.

    Guess who gets to the mind first?

    The only way for someone to learn it and get it right, is if they just accept that what you are telling them it means, is what it actually means.

    Even in the context of life and nature and math and every other context, it is not just meaningless, it is absurd.


  • Discourse touched me in a no-no place

    That's swimwear.


  • Discourse touched me in a no-no place

    @xaade said:

    Now we have a new problem.

    Yeah, what is this .Value stuff anyway? 😄

    You need to distinguish names, references and values. Not all languages really get to grips with that; the conflation of names and references is pretty common, and some get rather loose with the difference between references and values (and then reintroduce the whole thing in a half-assed way with “lvalues”). Once you can grasp the difference between these, you're well on your way to understanding what is actually going on.

    A variable is like a pigeonhole. The name is a label you put on it; everyone knows what a name is, even if they've never really thought about it before. The reference is like pointing to that specific pigeonhole (or at least saying where it is, without use of its name). The value is the thing(s) in the pigeonhole. (1D arrays are rows of pigeonholes, 2D a whole bank of them.) Unfortunately, going beyond that is where things start to stop bothering with anchoring in reality. It's just an analogy…



  • @xaade said:

    Set X to Y;

    Sounds like somebody like Cobol....not that that's a "Bad thing"....just sayin.....



  • @xaade said:

    I'd make exceptions for people who were never exposed to it in such a way to know about it.

    How very kind of you...
    @xaade said:
    But 2 of the 3 highschools I attended had programming courses.

    My school didn't, I don't think schools in general here do.
    @xaade said:
    How can you say, "I want this to be my career, but I don't want to make any effort on my own to learn it".

    Because you pay a large amount of money to an institution of learning to teach you? Can you imagine day one, the first class of the first year of a programming course starting off like "Hope you already know how to program!"



  • @loopback0 said:

    That's swimwear.

    That's not a mutually exclusive category. They're styled after underwear, people sometimes wear them as underwear, and they're generally not socially acceptable to wear as your only clothing anywhere other than at a beach or pool.



  • @KillaCoder said:

    @xaade said:
    But 2 of the 3 highschools I attended had programming courses.

    My school didn't, I don't think schools in general here do.

    I've been to schools that had massive workshops for welding, carpentry, and soldering circuit boards, but they never had a programming course.



  • Courses do assume a certain amount of pre-existing knowledge, and all Further and Higher education requires a certain amount of enthusiasm and willingness to learn outside of class.

    So going to a programming college with no previous exposure to programming is expecting to fail.



  • Not the university that I went to. They started at the absolute basics, assuming that you didn't have any programming experience at all.


  • Discourse touched me in a no-no place

    Same for me - although this didn't apply to all courses.



  • Not my programming course. I had zero knowledge, they started from square one, the absolute basics, and taught me all the way up to being qualified to work as a programmer.
    @lightsoff said:

    Higher education requires a certain amount of enthusiasm and willingness to learn outside of class.

    Of course, but I don't think it should require pre existing knowledge. Are we really expecting children (I started university at 17) to have planned out their career and already started training for it!?
    @lightsoff said:
    So going to a programming college with no previous exposure to programming is expecting to fail.

    Much of the class did fail, most after the first year. Out of the 20 odd who succeeded, I believe the vast majority had never programmed before college. I didn't know everyone's background but most were just like me, young folks who enjoyed computers and thought, why not try it?



  • Would you study History with no prior exposure to history?

    I don't mean "Competent in C++" or "Modded Minecraft", I mean "wrote a Hello World" in VBA or similar, or a BASIC program that insulted the user.


  • BINNED

    I used to be competent in C but then I got insulted by the framework.



  • For a concrete example, my Engineering degree assumed a fairly high level of Mathematics, esp. Mechanics, and Physics knowledge, as well as a small amount of simple programming - core concepts like assignment and flow.

    More advanced stuff like FEA, pointers and references were then taught from those starting points



  • @lightsoff said:

    Would you study History with no prior exposure to history?

    Yes.

    @lightsoff said:

    I don't mean "Competent in C++" or "Modded Minecraft", I mean "wrote a Hello World" in VBA or similar, or a BASIC program that insulted the user.

    I had done literally nothing with computers except used them. I couldn't have named a single programming language, in fact I'm pretty sure I didn't know there WERE languages, I believe I had a vague idea it'd all be binary and maths operators.

    Again, I think you are expecting WAY too much from children.



  • An 18 year old is not a child.



  • @lightsoff said:

    An 18 year old is not a child.

    I had to pick my course at 16 and started university at 17. I was a child.



  • @lightsoff said:

    For a concrete example, my Engineering degree assumed a fairly high level of Mathematics, esp. Mechanics, and Physics knowledge, as well as a small amount of simple programming - core concepts like assignment and flow.

    More advanced stuff like FEA, pointers and references were then taught from those starting points


    If programming was taught as a core subject from infancy up through primary and secondary school like maths is, then I would agree it'd be fair to expect prior knowledge.


  • FoxDev

    I can only speak for the UK system when I went through it, but pretty much no school teaches programming; the first you get exposed to it is at university


  • Discourse touched me in a no-no place

    I got exposed to it at A level. It was only VBA in Excel (writing it not just recording a macro) but it was some.



  • Yep same here in Ireland, we had a rare "Computer Skills" course that showed us Word, Excel, and how to set up an email address, that was it until day 1 of university.



  • Then I pity your education system.

    Unless you were born in the 70s or earlier in which case that would be fair.

    The UK taught BASIC (very basic) programming to 12-16 year olds since the advent of the BBC A/B/Master


  • FoxDev

    @lightsoff said:

    The UK taught BASIC (very basic) programming to 12-16 year olds since the advent of the BBC A/B/Master

    Not at the schools I attended



  • Did some checking - seems it stopped for a while, "replaced" by MS Office Skills in many schools.

    Sorry.



  • @lightsoff said:

    Then I pity your education system.

    Why? It taught me in Uni instead of secondary school, I still learned what I needed and I now work as a programmer. Sure it would have been nice to get a bit of programming experience in school to see what it was all about, but it wasn't necessary.

    Is it really so hard to spend a little extra time starting from the basics? I was scared enough starting Uni, if the lecturer had your attitude I'm pretty sure I would have broken down crying in the middle of the lecture :P

    @lightsoff said:

    Did some checking - seems it stopped for a while, "replaced" by MS Office Skills in many schools.

    Yeah we did a bit of that.


  • ♿ (Parody)

    @lightsoff said:

    Unless you were born in the 70s or earlier in which case that would be fair.

    My daughter starts high school next year. Her class catalog is very different than what mine looked like. Though to be fair, it's a better school all around than the one I attended.

    I had gotten my feet wet programming at age 8 when my parents got me a Commodore 64. I had mostly stopped by the time high school came around. I didn't do much until after college (though I had a CS 101 course where we did stuff in Pascal).

    I think assuming people must have programming knowledge to start a college curriculum of programming sort of stuff is pretty crazy. It's not the same realm as being proficient in math before beginning an engineering or physics program to me.



  • Exposure != knowledge.


  • ♿ (Parody)

    So what?



  • I mean that not having the basic understanding of the concepts of flow (eg flowcharts) and assignment makes learning an imperative language incredibly difficult.

    A class that needs to teach that to people who have no idea of either will lose the attention of students who have written any programs at all.


  • ♿ (Parody)

    @lightsoff said:

    A class that needs to teach that to people who have no idea of either will lose the attention of students who have written any programs at all.

    OK? There are ways around this. Many schools go to ridiculous lengths to get people into remedial reading or math classes. Determining if someone needs a foundation course or not shouldn't be too difficult for something like this.


Log in to reply