• (cs) in reply to Gribbles
    Gribbles:
    chubertdev:
    No mention of QBASIC yet?

    I taught beginning programming in QBASIC as recently as 2001 with great success--after two terms of QBASIC my students breezed through C and C++ classes.

    I will defend to the death imperative languages with Englishy syntax as the best way to learn programming for normal people. Precocious, autistic future Zucks can have Scheme.

    (captcha: abigo. Tengo un frio en mi cabeza, mi abigo.)

    Yeah, it teaches the basics, but it is also limited. I bet people exposed to QBASIC for too long are the types of people that write God objects and thousand line methods.

  • Shaun (unregistered) in reply to imgx64
    imgx64:
    I don't see the WTF here.

    Is it the ASCII art in comments? Meaningful ASCII art in comments can be pretty useful to understand the code, they're even used in Linux kernel code where appropriate.

    Is it trying to use an unsupported compiler? That's a rookie mistake, especially since GCC wasn't even installed on the computers.

    Is it the fact that Edu-C, probably a dumbed-down C for "education", doesn't understand C++ style comments (//) as opposed to C style comments (/* */)? Many earlier compilers didn't understand them either, they were added to the C standard in C99. Still not a WTF.

    I really don't see the WTF here.

    int result =0;
    //
    //We need to check which of the aritmetic operators we have: +-/*
    //
    //
    switch(operator)
    {
      case '+':
      result = a+b;
      break;
    <snip>
    }
    
    /* And now we display the result */
    printf("%d\n", result);
    /* Why he always 0????*/
    
  • TortoiseWrath (unregistered) in reply to newfweiler
    newfweiler:
    ubersoldat:
    TRWTF is teaching C to a middle-school student.

    Yeah, like letting a middle-school student learn to play the pipe organ or take the part of Hamlet in a school play or learn ancient Greek.

    I think you are assuming that this particular middle-school student has never had any exposure to programming and computer science before learning C. I doubt that this is the case. Some parents and schools do allow children who take interest in a field to excel in it at an early age.

    OK, but it sounds to me like this is an actual course being offered by the school. Do you know what computing course my middle school offered? "Introduction to Microsoft Word."

    I ended up with independent study in SQL, because I spoke personally with my school counselor about the lack of options for me. But I most certainly did not have an instructor who would sit down by me and find the query errors.

    Instead, I had Google, a copy of MySQL For Dummies, and a syntax highlighter.

    The school in this story is clearly doing something very wrong with their budget if they have staff who are, dedicating time to teaching C to middle school students. Mind you, these students are 10-12 years old. I didn't even learn PHP until I was 11. I was 15 by the time I learned C, and I was always considered "gifted." (In other words, I got to be in the reading group with the books WITHOUT pictures.)

    Just the concept of multiple 11-ish-year-olds in any reasonably-sized group would even be capable of learning C is foreign to me; I was the first student to do so in my high school in 20 years. Even in a large school (with an enrollment of, say, 1000 middle school students), I would only expect one or two of them to even be capable of understanding what programming is, let alone debug C compiler errors.

  • Jack (unregistered) in reply to Xarthaneon the Unclear
    Xarthaneon the Unclear:
    There's not just one TRWTF in this!
    1. This story takes place in middle school. Nothing good comes out of middle school, except Chuck Norris facts and 'That's What She Said' invocations at awkward times.

    2. The teacher nicely asked a middle school student not to write a program to take over the school. This means, that the minute he walked away, that was her first priority in life. She may or may not succeed, but still.

    3. The compiler fail. But, it makes for a distant third compared to the other two.

    Yo momma came out in Middle school

  • kory (unregistered) in reply to eViLegion
    eViLegion:
    trtrwtf:
    There might also be a simpler assumption that learning C is a bad way to start learning to program. This is incorrect.

    C is clearly an excellent language to start them off on... separate the wheat from the chaff early, and don't lull a bunch of morons into a false sense of capability by using something like Java.

    This and then some. I've met people from purely Java (and/or C#) backgrounds, and they're very good at Java (and/or c#). They often have little ability, however, to really delve into why the CPU is clocking out, or why memory's run out etc, because they don't undertsand what's actually going on under the hood. If you learn to program in C (where not dealing with memory properly will kill you - multiple times) then you should be able to adapt to other languages - even if there is a fundamental paradigm shift (READ: it might take you a while to kind of get into OO, but at least you'll understand enough about the work being done to limit suprious objects and the like)

  • awepo (unregistered) in reply to QJo
    QJo:
    newfweiler:
    ubersoldat:
    TRWTF is teaching C to a middle-school student.

    Yeah, like letting a middle-school student learn to play the pipe organ or take the part of Hamlet in a school play or learn ancient Greek.

    I think you are assuming that this particular middle-school student has never had any exposure to programming and computer science before learning C. I doubt that this is the case. Some parents and schools do allow children who take interest in a field to excel in it at an early age.

    Ancient Greek used to be made available to students considerably younger than nowadays; I believe that in some of the more traditional preparatory schools in Britain it still is. At the school I attended, Greek was one of the options at age 14 (I took Russian), while Latin was embarked upon seriously at age 11.

    The only problem with teaching a small child how to play a reed-and-pipe organ is that his/her feet will have trouble reaching the pedals, but apart from that, musical keyboard skills can be picked up before a child has learned to talk.

    As for playing Hamlet, I also believe there are establishments where Shakespeare plays are studied by children still in single-figure ages. We were definitely getting him by 12, and (again at my school) a friend of mine played Lady Macbeth at age 12

    The trouble with children nowadays is none of them get any education to stretch their capabilities worth a damn. Serious knowledge and learning is blocked from them by the misguided patronising attitude that they won't appreciate it. This is probably why childhood in certain nations of the Western world stretches into a person's 20's. It was less than a century ago that children were treated as adults by the time they were 14.

    I pity any fool who suffers shakespeare in a school context ever...

    less than a century ago 14 was adult? In which country?

  • Someone else (unregistered) in reply to Someone
    Someone:
    eViLegion:
    C is clearly an excellent language to start them off on... separate the wheat from the chaff early, and don't lull a bunch of morons into a false sense of capability by using something like Java.
    Since when did the purpose of a class become "separating the wheat from the chaff" instead of, you know, teaching? Whatever or not you agree with my previous post saying I don't think C is a good choice for an intro class, the choice of language should be guided by what will get the students to learn best. Picking the hardest language to can separate the students is the opposite of what teachers should be doing.
    ubersoldat:
    I don't think you can really teach a middle-scholar how to programming level you're referring to, since they mostly don't know many of the things they'll learn in a more advanced education (complex math, statistics, data structures, etc), so you're basically down to teaching them what it feels like to have a computer do what you want it to do.
    There is a lot of programming that you can do without having had move advanced math. And I'm not even sure what you mean by putting data structures in that list, because that's not something that you'll find outside of CS/programming courses, and I'm not convinced there's too much in the way of prerequisites for learning it.
    Oh dear! Why do you think it is in a CS course? Because people need to understand how data structures work, and why you might pick one over another (even if they never write one themselves). Data Structures and Algorithms are fundamental to Software Engineering - and all programmers/developers should see themselves as Software Engineers rather than mere code monkeys. I would say understanding sort algorithms and data structures is the single biggest factor that differentiates between a competent Engineer and someone whose code ends up on TDWTF. Whether you can create a Binary tree, or a Hashtable, or a stack is irrelevant (although I'd like to think most Software Engineers would be reasonably comfortable with creating the most common data structures), but unless you understand the difference between them, you'll quickly find yourself overwhelmed with even fairly basic problems....
  • Mike (unregistered) in reply to trtrwtf
    trtrwtf:
    Someone:
    Like I said, I understand where "learn C" proponents are coming from, but I think the circumstances where C is close to the best choice of languages are pretty narrow.

    I don't say it's the best. I say it's one of many, many good choices. There's no such thing as "best" in this domain, at least until we get much more specific about our goals.

    (I definitely think it's important to learn at some point)

    Nope, can't agree with you here. It's not something you'll ever go back to. Learn it first, or let it go. I know far too many programmers who have a laundry list of things to learn, and "learn C" or "really learn C" is always on the list for the ones under, say, 40. They never do learn it, because they don't need it, so it just becomes mental overhead - a little "thing to do" that will never happen. Chuck it and move on. This is the main argument for learning C first: that's when you'll actually benefit from it. Very few programmers actually need C, what they need is the stuff C will teach them.

    I love all of you, because you are forcing C down the COBOL path. In my part of the world COBOL (ok CoolGen....) has become a highly sought skill attracting high salaries. Why? Because everyone abandoned learning it because it was "old and cumbersome", but industry continued to want to support old systems that utilised it. I love that you are all pushing people away from learning C, becuase there is still a strong presence of C in the industry, and there are still tasks that (irrespective of potential advances in hardware in the future) are simply too inefficient in most of the modern day alternatives (large scale real-time server systems like, hmm, google probably do a large proportion of their work in C rather than Java or Python - because they need the low level control).

    I work with C# monkey^ who keeps bagging me that C is dead, and C# is the future, and I just nod and smile and watch as (though less widespread, perhaps) my skills are more desired than his = PROFIT.

    ^Actually, I don't think he's very capable even in C# - but that's another story....

  • Shim a Sham (unregistered) in reply to Gribbles
    Gribbles:
    chubertdev:
    No mention of QBASIC yet?

    I taught beginning programming in QBASIC as recently as 2001 with great success--after two terms of QBASIC my students breezed through C and C++ classes.

    I will defend to the death imperative languages with Englishy syntax as the best way to learn programming for normal people. Precocious, autistic future Zucks can have Scheme.

    (captcha: abigo. Tengo un frio en mi cabeza, mi abigo.)

    I started on q-Basic (aged about 12 or 13), and other than a brief look at (a relatively early) Visual Basic transitioned easily into C (C not C++ - although I'm reasonably comfortable with either, I claim reasonable expertise in C, however I wouldn't claim it for C++)

  • Yazeran (unregistered) in reply to cellocgw
    cellocgw:
    kotaKat:
    I was in an actual robotics class with VEX robots (awesome, but getting pricey). Teacher forced the class to use LabVIEW. I fought and used RobotC for Vex.

    I was the only one to actually complete assignments (including his 'challenge course' that nobody got as far as I would) and he would bitch because I wasn't using LabVIEW.

    ... hey, it's easier to subroutine everything in C!

    There's TWWTF (worse...) : using LabView to do anything even vaguely complicated. It's a shining example of non-commentable, unreadable, undebuggable code.

    Yea, Like I use to say whenever someone is mentioning LabView: It's fine for playing, but you still cant get a screen big enough to make anything useful with it.

  • QJo (unregistered) in reply to awepo
    awepo:
    QJo:
    newfweiler:
    ubersoldat:
    TRWTF is teaching C to a middle-school student.

    Yeah, like letting a middle-school student learn to play the pipe organ or take the part of Hamlet in a school play or learn ancient Greek.

    I think you are assuming that this particular middle-school student has never had any exposure to programming and computer science before learning C. I doubt that this is the case. Some parents and schools do allow children who take interest in a field to excel in it at an early age.

    Ancient Greek used to be made available to students considerably younger than nowadays; I believe that in some of the more traditional preparatory schools in Britain it still is. At the school I attended, Greek was one of the options at age 14 (I took Russian), while Latin was embarked upon seriously at age 11.

    The only problem with teaching a small child how to play a reed-and-pipe organ is that his/her feet will have trouble reaching the pedals, but apart from that, musical keyboard skills can be picked up before a child has learned to talk.

    As for playing Hamlet, I also believe there are establishments where Shakespeare plays are studied by children still in single-figure ages. We were definitely getting him by 12, and (again at my school) a friend of mine played Lady Macbeth at age 12

    The trouble with children nowadays is none of them get any education to stretch their capabilities worth a damn. Serious knowledge and learning is blocked from them by the misguided patronising attitude that they won't appreciate it. This is probably why childhood in certain nations of the Western world stretches into a person's 20's. It was less than a century ago that children were treated as adults by the time they were 14.

    I pity any fool who suffers shakespeare in a school context ever...

    less than a century ago 14 was adult? In which country?

    At the age of 14 in Britain you would have the option of leaving school and going to work, earning a living (or contributing towards a living) working in a shop, or the fields, or a factory, or whatever. You would be under adult rules, and wearing adult clothes, and expecting to comport yourself as an adult. You would probably also be eyeing up the local members of the opposite sex and smoking in the back alley behind your workplace. You would have been going to the pub with your father and uncles and drinking a modest quantity of ale (having had your initiation getting disgustingly plastered at least once). You would have been getting married at 16 or 17 to your sweetheart and going into the army to do your national service. And if you'd got into trouble you would have been tried as an adult and made to serve out your sentence as an adult.

    Compare and contrast C21.

  • Hasse (unregistered) in reply to AnonCoward23
    Lone Marauder:
    And I wouldn't have known that you can break comments across lines
    Not just comments, but all lines.

    Back to good old Fortran: A character in column 6 was for continuing the previous line. How many times have I per accident written some code all starting in column 6 ...

  • ben (unregistered)

    "Do you know what’s wrong, Mr. Artyom?” “No, I don’t.” “A good programmer needs to be creative. Any ideas?”

    !!!

  • Adino (unregistered)

    Always blame the compiler. Sigh :( // comment
    command

    just multi-line comment. It's like wondering why following compiles int main(void) { http://google.com return 0; }

  • Neil (unregistered) in reply to wrojr
    wrojr:
    The real WTF is inventing a class, with young students, with a fictional edu-C compiler, instead of making fun of those funny comments and the importance of commenting evrything in code.
    I misread that as commenting everything out...
  • anonymous roboticist (unregistered) in reply to Zecc

    Actually, this is common in robotics, where you need to define a local coordinate frame. It's conventionally called "North East Down"

    http://en.wikipedia.org/wiki/Axes_conventions#Ground_reference_frames:_ENU_and_NED

  • stew (unregistered) in reply to imgx64
    imgx64:
    I really don't see the WTF here.
    The particularly egregiously incorrect usage of "an" would qualify.
  • instigator (unregistered) in reply to eViLegion
    eViLegion:
    When you have three perpendicular axes, both left/right handedness AND the names you give to those axes are completely arbitrary.

    Maths doesn't stop working just because you called something X that someone else called Y.

    The real WTF is that you seem to understand coordinate systems, yet it hasn't occured to you that left/right x/y/z doesn't actually matter even in the slightest, so long as it is consistently applied.

    Consistency is the point. It makes things much easier when you stick with a convention. But yes, you can always do whatever the fuck you want.

  • instigator (unregistered) in reply to trtrwtf
    trtrwtf:
    (this would exclude toy languages like LOGO and web-specific languages like PHP, as well as hipster affectations like Haskell and other esoterics, but it would include C, Lisp, Java, Ruby, and so forth)
    Your allowing Ruby but not Haskell. Not that I care about either one, but how is Ruby better than Haskell?
  • trtrwtf (unregistered) in reply to instigator
    instigator:
    Your allowing Ruby but not Haskell. Not that I care about either one, but how is Ruby better than Haskell?

    That's just me being snide, mostly - but I think there's truth in it. I've used both (not deeply, I admit) and Ruby feels like a language for doing stuff, and Haskell feels like a language for proving a point. And if you're teaching someone to write programs, you should really give them a language that's used to write programs.

    (this is also why I excluded LOGO - it's "optimized" for educational purposes and not for actually making stuff that works, which makes it a terrible tool for teaching)

  • Flaming Shearer (unregistered)

    I learned Ancient Greek in junior high school. In high school, we did Latin and Greek, along with Greek History. (The Greeks, for example, used C++, while the Romans used Java).

  • (cs) in reply to Shim a Sham
    Shim a Sham:
    Gribbles:
    chubertdev:
    No mention of QBASIC yet?

    I taught beginning programming in QBASIC as recently as 2001 with great success--after two terms of QBASIC my students breezed through C and C++ classes.

    I will defend to the death imperative languages with Englishy syntax as the best way to learn programming for normal people. Precocious, autistic future Zucks can have Scheme.

    (captcha: abigo. Tengo un frio en mi cabeza, mi abigo.)

    I started on q-Basic (aged about 12 or 13), and other than a brief look at (a relatively early) Visual Basic transitioned easily into C (C not C++ - although I'm reasonably comfortable with either, I claim reasonable expertise in C, however I wouldn't claim it for C++)

    When I was 12 there was no access to computers at school, so we built them ourselves out of matchboxes and beads, and simulated them with pencil and paper. When computers for the masses finally arrived at the end of the '70s, we youngsters had cut our teeth on writing flow diagrams and analysing processes algorithmically before writing our first line of computer code. My first "actual" programming experience was in ALGOL 68 on coding sheets, on which I wrote a routine to calculate the first 20 factorials. Then I went up to Uni where I learned Basic on a Prime, and Pascal on a North Star Horizon, and shortly after, Basic on a BBC-B.

    Teaching Javascript, CSS and HTML sounds like a sensible way to eddicate kids into programming nowadays, though I thoroughly endorse C.

  • (cs) in reply to eViLegion
    eViLegion:
    Gene Wirchenko:
    Was he? I have run across the attitude of using some course to weed out people. How do you tell the difference between someone holding view A and expressing it sarcastically to sound like the opposite view B and someone expressing view B?
    • snipped most -

    If your aim is to employ the best possible programmers out of school, you'd probably rather their teachers subjected them to the most brutal of courses possible, so that the only ones left are certifiable geniuses (or, I guess, simply certifiable).

    No, I would not. I want them to be taught, not tortured. There will be people of different skill levels regardless of the methodology. I would prefer the methodology be humane.

    Why should someone who would be very good at programming put up with bad treatment? (Or anyone do so?) Maybe that potentially-excellent programmer decides, "Who needs this? I think I will go with one of my other options."

    Sincerely,

    Gene Wirchenko

  • modifiable lvalue (unregistered) in reply to trtrwtf

    I feel overwhelmed by the sheer amount of misinformation you're spreading. If you're such an expert on C, I suggest writing a compiler for it. You'll learn so much!

    trtrwtf:
    There might also be a simpler assumption that learning C is a bad way to start learning to program. This is incorrect.

    No, it isn't.

    trtrwtf:
    ... but C is a fine first language...

    No, it isn't.

    trtrwtf:
    (this would exclude toy languages like LOGO and web-specific languages like PHP, as well as hipster affectations like Haskell and other esoterics, but it would include C, Lisp, Java, Ruby, and so forth)

    It's fair enough to list PHP as undesirable for beginners. That language is documented mostly by the implementation (written in C), which relies upon undefined behaviour. If you don't know what that means, or you can't see anything wrong with that, continue reading by all means.

    How can it be that you'd suggest learning C or Lisp as a first programming language, but not Haskell or Logo? You seem to lack an understanding of programming paradigms and undefined behaviour, which are two hurdles for learning programming languages.

    trtrwtf:
    The hard part is learning to program, not learning one syntax or another.

    As any university student studying linguistics will tell you: Syntax isn't the only important aspect of languages.

    "Colourless green ideas sleep furiously." -- Noam Chomsky

    trtrwtf:
    If you can't get the basics of programming in C, you probably can't understand them in any language.

    The syntax of C might give the impression of a well-defined language. Don't let this fool you. I quoted a famous example from Noam Chomsky to demonstrate a distinction from syntax and semantics in English. The sentence might be grammatically correct, but it's semantically dribble; It makes no sense.

    C has such a distinction, and room for a far deeper level of misinterpretation than most programming languages, too. Most of that misinterpretation occurs in the realms of undefined behaviour, which most other programming languages don't have.

    Undefined behaviour makes testing and debugging difficult in C. A program that invokes undefined behaviour might appear to work, if only by coincidence. Upgrading the compiler or C standard library, the OS or the computer could cause the program to break. Can you imagine how this might affect the score of a student if the professor uses a different OS and compiler?

    If you've never heard of undefined behaviour, then you've never really learnt C. Stop commenting about it.

    trtrwtf:
    ... you really get an understanding of the memory problems that higher-level languages quite correctly hide from you.

    "Higher-level" isn't well defined, though I would suggest that C programs running on a Lisp machine are presented with an entirely different set of memory problems.

    trtrwtf:
    Now, many programmers do just fine without really understanding memory, but if you can get that visceral understanding of the stack and the heap into a kid's head from the start, you've made them a better programmer, and that's a good thing.

    Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    Is a misplaced "understanding of the stack and the heap" more important than the ability to test and debug your programs, to ensure that they are actually valid programs while learning? No.

    trtrwtf:
    That's just me being snide, mostly - but I think there's truth in it. I've used both (not deeply, I admit) and Ruby feels like a language for doing stuff, and Haskell feels like a language for proving a point. And if you're teaching someone to write programs, you should really give them a language that's used to write programs.

    If you're going to put yourself in the place of a teacher, you really shouldn't write like an idiot. Your priorities are backwards. I suggest going back to primary school and having your English tested before writing a C compiler to be ACVS or CVSA tested. You're probably better off writing the C compiler in Haskell than in C or Ruby.

    CAPTCHA: dolor. trtrwtf is a dolor.

  • trtrwtf (unregistered) in reply to modifiable lvalue
    modifiable lvalue:
    [various drivel snipped, because it's really not worth responding to]

    Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    What would this have to do with anything? Do you really think you can write a moderately complex program in C without understanding how memory works? If you think it's useful to know how the machine works, C is a good way to guarantee that a student understands this.

    (or, I suppose, that a student who can't manage to understand this doesn't get any further, which is just as good)

    Is a misplaced "understanding of the stack and the heap" more important than the ability to test and debug your programs, to ensure that they are actually valid programs while learning? No.

    Have you ever had to explain aliasing to a "senior" programmer? I have. The guy had created a bug which he was unable to test and debug, because he didn't understand the structure of memory in his machine. So, based on my experience, yes, this understanding is essential, and it's not misplaced. It's all well and good to write in high-level languages, but if you can't think at the low level when needed, you're going to have a lot of problems.

    As I say, it's also possible to teach a student using Java or C# just about any other serious language, but C has some advantages, which are worth understanding. Simply frothing at the mouth about them isn't really convincing.

    [gratuitous Chomsky quote snipped] Undefined behaviour makes testing and debugging difficult in C. A program that invokes undefined behaviour might appear to work, if only by coincidence. Upgrading the compiler or C standard library, the OS or the computer could cause the program to break. Can you imagine how this might affect the score of a student if the professor uses a different OS and compiler?

    Yes, I can see how that would be a problem. So your students use the gcc, you make sure their installation is good, and off you go. If they have problems, you help them sort them out. Environment issues and wonky installs are part of programming. You deal with them. The issues with C are not especially weird.

    How can it be that you'd suggest learning C or Lisp as a first programming language, but not Haskell or Logo?

    I've already explained that. I want people to use real languages that write real deployable code. Toy languages are not a great way to learn to program.

  • trtrwtf (unregistered) in reply to Gene Wirchenko
    Gene Wirchenko:
    No, I would not. I want them to be taught, not tortured. There will be people of different skill levels regardless of the methodology. I would prefer the methodology be humane.

    I love the idea that teaching someone C is "inhumane".

    "Okay, Ahmed, I'm going to ask you one more time, and if you don't tell me the name of your cell's leader, it's going to be hard on you"

    "You'll never make me talk!"

    "Oh, yeah? Boys, teach him about pointers."

    "Oh no! Anything but that, I'll talk, please, just don't make me learn C!"

  • Hrm (unregistered) in reply to Matt Westwood
    Matt Westwood:
    ... When I was 12 there was no access to computers at school, so we built them ourselves out of matchboxes and beads, and simulated them with pencil and paper. When computers for the masses finally arrived at the end of the '70s, we youngsters had cut our teeth on writing flow diagrams and analysing processes algorithmically before writing our first line of computer code. My first "actual" programming experience was in ALGOL 68 on coding sheets, on which I wrote a routine to calculate the first 20 factorials. Then I went up to Uni where I learned Basic on a Prime, and Pascal on a North Star Horizon, and shortly after, Basic on a BBC-B. ...

    Very cool history.

    Programmable calculator here, factoring integers using a naive algorithm. It took forever, and was even slower than doing it by hand. It pissed me off so much I programmed it to do a tight goto loop and left it in a corner. When I got back to it the batteries had run down, which I thought was pretty funny. It got the last laugh, though. After that, it was never the same and would run down batteries 2x faster. A friend of mine who did the same thing on the same kind of calculator, noticed too that it ate up batteries much faster.

    My first real computer experience was with an Apple II. I hacked in Basic a while before discovering assembly language. For those not familiar with 6502, it's much more fun than you would expect. Then later I got into 68000 assembler and really liked it. After that, I learned C and only touch assembler when required.

    Back then, it was easily possible for someone to understand absolutely everything about their computers, the O/Ses and the languages used to write them. Today, not so much...

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    My first "actual" programming experience was in ALGOL 68 on coding sheets, on which I wrote a routine to calculate the first 20 factorials.

    Today is going by too slowly.

        var msg = '';
        for (i = 1; i <= 20; i++) {
            result = 1;
            for (n = 2; n <= i; n++) {
                result *= n;
            }
            msg += i + '!: ' + result + '\n';
            
        }
        alert(msg);
    
  • modifiable lvalue (unregistered) in reply to trtrwtf
    trtrwtf:
    modifiable lvalue:
    ... Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    What would this have to do with anything? Do you really think you can write a moderately complex program in C without understanding how memory works? If you think it's useful to know how the machine works, C is a good way to guarantee that a student understands this.

    The problem is that you're not suggesting learning C, but a subset of C that is highly system-dependant, non-portable and definitely not C. Are you sure that's what you want to teach?

    The C standard says: The semantic descriptions in this International Standard describe the behavior of an abstract machine... In the abstract machine, all expressions are evaluated as specified by the semantics.

    Notice the keyword "abstract". Is it relevant to know how memory works on your x86? No! If you want to learn that, you'll need to learn more than C will teach you. C doesn't teach you real and protected mode x86 assembly. C doesn't teach you all of the stages of booting. C doesn't teach you about paging... and just like none of that is relevant in C, none of it is relevant in C#.

    trtrwtf:
    Is a misplaced "understanding of the stack and the heap" more important than the ability to test and debug your programs, to ensure that they are actually valid programs while learning? No.

    Have you ever had to explain aliasing to a "senior" programmer? I have. The guy had created a bug which he was unable to test and debug, because he didn't understand the structure of memory in his machine. So, based on my experience, yes, this understanding is essential, and it's not misplaced. It's all well and good to write in high-level languages, but if you can't think at the low level when needed, you're going to have a lot of problems.

    It's misplaced because it's not required, and I find myself repeating myself: Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    "Low level"?! What gibberish! Only first and second generation programming languages are low level. C is a third generation programming language. Are C++, C#, Java, BASIC and Pascal also "low level"?

    Where in the C standard is it stated that C must be compiled on your Intel x86 processor? That'd be the significant requirement of being "low level". I've already quoted evidence to the contrary... Consider the definition of the word "abstract".

    Based on your experience, undefined behaviour that "works" isn't a problem. When will people actually learn from the THERAC-25 incident? You should be put to death...

    trtrwtf:
    [gratuitous Chomsky quote snipped] Undefined behaviour makes testing and debugging difficult in C. A program that invokes undefined behaviour might appear to work, if only by coincidence. Upgrading the compiler or C standard library, the OS or the computer could cause the program to break. Can you imagine how this might affect the score of a student if the professor uses a different OS and compiler?

    Yes, I can see how that would be a problem. So your students use the gcc, you make sure their installation is good, and off you go. If they have problems, you help them sort them out. Environment issues and wonky installs are part of programming. You deal with them. The issues with C are not especially weird.

    What happens to the undefined behaviour that they don't spot, because "the program works"? In six months time they try to compile and run it using gcc on their ARM processor instead of their x86 processor, and all of the sudden a problem pops up. They then learn what a crappy teacher you were. Hopefully one of them pays your carpenter to install dodgy foil insulation and you die in a fire. You don't seem to have grasped the concept of "undefined behaviour", yet.

    I may seem resentful. It's only because I see so much unnecessarily non-portable code written by people like yourself who couldn't be bothered picking up K&R to actually learn the language. You might as well mash your dribbling faecal orifice all over the keyboard to produce your programs.

    trtrwtf:
    How can it be that you'd suggest learning C or Lisp as a first programming language, but not Haskell or Logo?

    I've already explained that. I want people to use real languages that write real deployable code. Toy languages are not a great way to learn to program.

    Have you written that compiler, yet?

  • David (unregistered) in reply to trtrwtf

    How does C teach you about the stack? Like every other high-level language, it hides all the details from you. If you want to know the real basics, learn assembly language.

    that effort is one most programmers won't make, since they will (quite correctly) prioritize moving forward rather than backfilling the basics.

    That makes no sense. If you can move forward without backfilling the basics, the basics weren't really all that basic in the first place. If professionals quite correctly prioritize learning high-level stuff over the low-level details, why force early students to learn the low-level details, since they obviously won't need it?

  • Kasper (unregistered) in reply to gormless
    gormless:
    frist! we take over the world
    Then we take Berlin.
  • (cs) in reply to CA
    CA:
    I have never complained about the quality of the articles here until now. I think it is written somewhere that TDWTF does not post stories of students or amateurs, but instead tends to post stories of our so beloved "elite programmers". So wtf is this? Next thing you know we will be seing stories where nerdy parents complain that their 5 year old son does not know how to debug PHP.

    The student wasn't at fault here.

    I think the article author assumed the WTF was the teacher's (using the wrong compiler), and didn't realise the real cause.

    I must admit, I knew about \ continuation characters, but had forgotten about them (as with trigraphs, which caught me out recently), as I never use trigraphs, and only use the continuation character on big macros (which I try to avoid nowadays), so I'd not related them to this situation.

    I suspect the real issue was that 'Edu-C' had kindly trimmed spaces off the ends of lines, so they didn't confuse users, which made the original '<space>' (not a continuation character) into '' (a continuation character).

  • trtrwtf (unregistered) in reply to David
    David:
    If professionals quite correctly prioritize learning high-level stuff over the low-level details, why force early students to learn the low-level details, since they obviously won't need it?

    Why should they learn the low-level details? Because the low-level details make you a better programmer, and we want programmers to be better. Why should professionals prioritize learning high-level programming techniques over low-level details? Because time is finite, and it becomes more so as you go on. Since the groundwork is infinitely deep, and there are few or no natural stopping points where you can say "I have now learned enough", so an arbitrary stopping point is needed if we're not going to spend our whole lives preparing. The better our preparations, the better off we are, but we shouldn't put off the work until our preparations are perfect. Eventually, we have to get on with it.

  • Buddy (unregistered) in reply to chubertdev
    chubertdev:
    Matt Westwood:
    My first "actual" programming experience was in ALGOL 68 on coding sheets, on which I wrote a routine to calculate the first 20 factorials.

    Today is going by too slowly.

        var msg = '';
        for (i = 1; i <= 20; i++) {
            result = 1;
            for (n = 2; n <= i; n++) {
                result *= n;
            }
            msg += i + '!: ' + result + '\n';
            
        }
        alert(msg);
    

    First twenty factorials could be 0 to 19 or 1 to 20.

    Your code can be optimized big time (19 vs. 190 multiplications). This is likely similar to what Matt Westwood was doing in Algol those years ago.

        var msg = '1!: 1\n';
        var result = 1;
        for (var i = 2; i <= 20; i++) {
            result *= i;
            msg += i + '!: ' + result + '\n';
        }
        alert(msg);
    

    Does it matter which is used? Sadly, these days, usually not...

  • urza9814 (unregistered) in reply to TortoiseWrath
    TortoiseWrath:
    newfweiler:
    ubersoldat:
    TRWTF is teaching C to a middle-school student.

    Yeah, like letting a middle-school student learn to play the pipe organ or take the part of Hamlet in a school play or learn ancient Greek.

    I think you are assuming that this particular middle-school student has never had any exposure to programming and computer science before learning C. I doubt that this is the case. Some parents and schools do allow children who take interest in a field to excel in it at an early age.

    OK, but it sounds to me like this is an actual course being offered by the school. Do you know what computing course my middle school offered? "Introduction to Microsoft Word."

    I ended up with independent study in SQL, because I spoke personally with my school counselor about the lack of options for me. But I most certainly did not have an instructor who would sit down by me and find the query errors.

    Instead, I had Google, a copy of MySQL For Dummies, and a syntax highlighter.

    The school in this story is clearly doing something very wrong with their budget if they have staff who are, dedicating time to teaching C to middle school students. Mind you, these students are 10-12 years old. I didn't even learn PHP until I was 11. I was 15 by the time I learned C, and I was always considered "gifted." (In other words, I got to be in the reading group with the books WITHOUT pictures.)

    Just the concept of multiple 11-ish-year-olds in any reasonably-sized group would even be capable of learning C is foreign to me; I was the first student to do so in my high school in 20 years. Even in a large school (with an enrollment of, say, 1000 middle school students), I would only expect one or two of them to even be capable of understanding what programming is, let alone debug C compiler errors.

    Oh please. In my grade school (class size of about 45) we learned BASIC and LOGO and such starting around second grade; by middle school Visual Basic was offered and Java was shortly after that. Always had a few dozen kids in those. Though of course none of those are C. I was using C-like languages (NQC -- a variant of C for robotics) in 5th grade and trying to teach it to my classmates by 6th. Started teaching myself C++ by 7th. Granted, they're not going to be doing anything too complex with it, but the basics really aren't that hard. Could CERTAINLY get some middle school kids writing some simple games with a graphics library like Allegro in a full year course.

  • urza9814 (unregistered) in reply to Someone else
    Someone else:
    Someone:
    eViLegion:
    C is clearly an excellent language to start them off on... separate the wheat from the chaff early, and don't lull a bunch of morons into a false sense of capability by using something like Java.
    Since when did the purpose of a class become "separating the wheat from the chaff" instead of, you know, teaching? Whatever or not you agree with my previous post saying I don't think C is a good choice for an intro class, the choice of language should be guided by what will get the students to learn best. Picking the hardest language to can separate the students is the opposite of what teachers should be doing.
    ubersoldat:
    I don't think you can really teach a middle-scholar how to programming level you're referring to, since they mostly don't know many of the things they'll learn in a more advanced education (complex math, statistics, data structures, etc), so you're basically down to teaching them what it feels like to have a computer do what you want it to do.
    There is a lot of programming that you can do without having had move advanced math. And I'm not even sure what you mean by putting data structures in that list, because that's not something that you'll find outside of CS/programming courses, and I'm not convinced there's too much in the way of prerequisites for learning it.
    Oh dear! Why do you think it is in a CS course? Because people need to understand how data structures work, and why you might pick one over another (even if they never write one themselves). Data Structures and Algorithms are fundamental to Software Engineering - and all programmers/developers should see themselves as Software Engineers rather than mere code monkeys. I would say understanding sort algorithms and data structures is the single biggest factor that differentiates between a competent Engineer and someone whose code ends up on TDWTF. Whether you can create a Binary tree, or a Hashtable, or a stack is irrelevant (although I'd like to think most Software Engineers would be reasonably comfortable with creating the most common data structures), but unless you understand the difference between them, you'll quickly find yourself overwhelmed with even fairly basic problems....

    So...what, if we can't make them into perfect Software Engineers in middle school, then we shouldn't even try to get them interested in the subject? I'm not sure I understand what you're getting at...sure it's necessary to know that stuff by the time you enter the workforce, but the point being made was that there's plenty you can learn before that, and even if you do want to teach data structures first, it's simple enough that even middle school kids should be able to grasp the basic concepts.

  • trtrwtf (unregistered) in reply to urza9814
    urza9814:
    even if you do want to teach data structures first, it's simple enough that even middle school kids should be able to grasp the basic concepts.

    Exactly this. In fact, if you give kids the basic concepts, which they can grapple with, they then find it a lot easier to get the math underlying them. (Is it easier to teach logarithms to a kid before or after they've written linear and binary search routines, and looked at their performance?)

  • RandomGuy (unregistered)

    I'd rather use block comment to comment out block of code rather than comment out every single line of the block with line comments.

  • trtrwtf (unregistered) in reply to RandomGuy
    RandomGuy:
    I'd rather use block comment to comment out block of code rather than comment out every single line of the block with line comments.

    There are good arguments for either. If you're on a large project, and you're trying to find references to a particular function, it's nice to be able to search the codebase and see from the search results whether the reference is live or commented out. It also shows up more effectively in a diff: the whole block of code shows up as commented, not just two lines. So line comments have some good features for communicating intent.

    I agree that block comments are aesthetically nicer, and I use them on my own time, but as a member of a team I usually push for line comments as the house style when commenting out code.

  • Gribbles (unregistered) in reply to modifiable lvalue
    modifiable lvalue:
    When will people actually learn from the THERAC-25 incident?

    Burn!

  • Meep (unregistered) in reply to ubersoldat
    ubersoldat:
    TRWTF is teaching C to a middle-school student.

    Don't get me wrong, I think C is one of the best things to happen to humanity

    Yeah, it's right up there with polio.

  • Deekoo (unregistered)

    TRWTF is that my irony detector seems to be broken - it's claiming that some of the various 'eleven is too young to learn C!' posts are sincere.

    Sure, there may be only two eleven year old kids in a typical school already capable of writing programs in C. But then, there are probably not very many competent historians in middle school, yet that doesn't deter us from teaching history.

    The undefined and inconsistent behaviour isn't that big a deal - any language with a history of real-world use has undefined and inconsistent behaviour across multiple implementations. 'print "Hello World"' is a SyntaxError in Python 3.2, for example, and I've run into an awful lot of Java apps that seem to actually care what JVM and OS you run them on. (And environment-specific warts affect other classes - is the difference in behaviour between Visual Studio targeting a Win8 surface tablet and gcc targeting OpenBSD desktops that much harder to deal with than bureaucrats who demand that paleontology be taught in a way that does not contradict young-earth creationism?)

  • Unreferenced Null Pointer (unregistered) in reply to modifiable lvalue
    modifiable lvalue:
    I feel overwhelmed by the sheer amount of misinformation you're spreading. If you're such an expert on C, I suggest writing a compiler for it. You'll learn so much!
    trtrwtf:
    There might also be a simpler assumption that learning C is a bad way to start learning to program. This is incorrect.

    No, it isn't.

    trtrwtf:
    ... but C is a fine first language...

    No, it isn't.

    trtrwtf:
    (this would exclude toy languages like LOGO and web-specific languages like PHP, as well as hipster affectations like Haskell and other esoterics, but it would include C, Lisp, Java, Ruby, and so forth)

    It's fair enough to list PHP as undesirable for beginners. That language is documented mostly by the implementation (written in C), which relies upon undefined behaviour. If you don't know what that means, or you can't see anything wrong with that, continue reading by all means.

    How can it be that you'd suggest learning C or Lisp as a first programming language, but not Haskell or Logo? You seem to lack an understanding of programming paradigms and undefined behaviour, which are two hurdles for learning programming languages.

    trtrwtf:
    The hard part is learning to program, not learning one syntax or another.

    As any university student studying linguistics will tell you: Syntax isn't the only important aspect of languages.

    "Colourless green ideas sleep furiously." -- Noam Chomsky

    trtrwtf:
    If you can't get the basics of programming in C, you probably can't understand them in any language.

    The syntax of C might give the impression of a well-defined language. Don't let this fool you. I quoted a famous example from Noam Chomsky to demonstrate a distinction from syntax and semantics in English. The sentence might be grammatically correct, but it's semantically dribble; It makes no sense.

    C has such a distinction, and room for a far deeper level of misinterpretation than most programming languages, too. Most of that misinterpretation occurs in the realms of undefined behaviour, which most other programming languages don't have.

    Undefined behaviour makes testing and debugging difficult in C. A program that invokes undefined behaviour might appear to work, if only by coincidence. Upgrading the compiler or C standard library, the OS or the computer could cause the program to break. Can you imagine how this might affect the score of a student if the professor uses a different OS and compiler?

    If you've never heard of undefined behaviour, then you've never really learnt C. Stop commenting about it.

    trtrwtf:
    ... you really get an understanding of the memory problems that higher-level languages quite correctly hide from you.

    "Higher-level" isn't well defined, though I would suggest that C programs running on a Lisp machine are presented with an entirely different set of memory problems.

    trtrwtf:
    Now, many programmers do just fine without really understanding memory, but if you can get that visceral understanding of the stack and the heap into a kid's head from the start, you've made them a better programmer, and that's a good thing.

    Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    Is a misplaced "understanding of the stack and the heap" more important than the ability to test and debug your programs, to ensure that they are actually valid programs while learning? No.

    trtrwtf:
    That's just me being snide, mostly - but I think there's truth in it. I've used both (not deeply, I admit) and Ruby feels like a language for doing stuff, and Haskell feels like a language for proving a point. And if you're teaching someone to write programs, you should really give them a language that's used to write programs.

    If you're going to put yourself in the place of a teacher, you really shouldn't write like an idiot. Your priorities are backwards. I suggest going back to primary school and having your English tested before writing a C compiler to be ACVS or CVSA tested. You're probably better off writing the C compiler in Haskell than in C or Ruby.

    CAPTCHA: dolor. trtrwtf is a dolor.

    What concerns me more, is you being unable to use "Preview" to detect and solve puny typos in your comment. Software developer not able to parse BBCode?

    Preview is your friend.

  • Unreferenced Null Pointer (unregistered) in reply to modifiable lvalue
    modifiable lvalue:
    trtrwtf:
    modifiable lvalue:
    ... Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    What would this have to do with anything? Do you really think you can write a moderately complex program in C without understanding how memory works? If you think it's useful to know how the machine works, C is a good way to guarantee that a student understands this.

    The problem is that you're not suggesting learning C, but a subset of C that is highly system-dependant, non-portable and definitely not C. Are you sure that's what you want to teach?

    The C standard says: The semantic descriptions in this International Standard describe the behavior of an abstract machine... In the abstract machine, all expressions are evaluated as specified by the semantics.

    Notice the keyword "abstract". Is it relevant to know how memory works on your x86? No! If you want to learn that, you'll need to learn more than C will teach you. C doesn't teach you real and protected mode x86 assembly. C doesn't teach you all of the stages of booting. C doesn't teach you about paging... and just like none of that is relevant in C, none of it is relevant in C#.

    trtrwtf:
    Is a misplaced "understanding of the stack and the heap" more important than the ability to test and debug your programs, to ensure that they are actually valid programs while learning? No.

    Have you ever had to explain aliasing to a "senior" programmer? I have. The guy had created a bug which he was unable to test and debug, because he didn't understand the structure of memory in his machine. So, based on my experience, yes, this understanding is essential, and it's not misplaced. It's all well and good to write in high-level languages, but if you can't think at the low level when needed, you're going to have a lot of problems.

    It's misplaced because it's not required, and I find myself repeating myself: Where in the C standard is the term "stack" or "heap" mentioned? Nowhere.

    "Low level"?! What gibberish! Only first and second generation programming languages are low level. C is a third generation programming language. Are C++, C#, Java, BASIC and Pascal also "low level"?

    Where in the C standard is it stated that C must be compiled on your Intel x86 processor? That'd be the significant requirement of being "low level". I've already quoted evidence to the contrary... Consider the definition of the word "abstract".

    Based on your experience, undefined behaviour that "works" isn't a problem. When will people actually learn from the THERAC-25 incident? You should be put to death...

    trtrwtf:
    [gratuitous Chomsky quote snipped] Undefined behaviour makes testing and debugging difficult in C. A program that invokes undefined behaviour might appear to work, if only by coincidence. Upgrading the compiler or C standard library, the OS or the computer could cause the program to break. Can you imagine how this might affect the score of a student if the professor uses a different OS and compiler?

    Yes, I can see how that would be a problem. So your students use the gcc, you make sure their installation is good, and off you go. If they have problems, you help them sort them out. Environment issues and wonky installs are part of programming. You deal with them. The issues with C are not especially weird.

    What happens to the undefined behaviour that they don't spot, because "the program works"? In six months time they try to compile and run it using gcc on their ARM processor instead of their x86 processor, and all of the sudden a problem pops up. They then learn what a crappy teacher you were. Hopefully one of them pays your carpenter to install dodgy foil insulation and you die in a fire. You don't seem to have grasped the concept of "undefined behaviour", yet.

    I may seem resentful. It's only because I see so much unnecessarily non-portable code written by people like yourself who couldn't be bothered picking up K&R to actually learn the language. You might as well mash your dribbling faecal orifice all over the keyboard to produce your programs.

    trtrwtf:
    How can it be that you'd suggest learning C or Lisp as a first programming language, but not Haskell or Logo?

    I've already explained that. I want people to use real languages that write real deployable code. Toy languages are not a great way to learn to program.

    Have you written that compiler, yet?

    The problem are so called programmers who cannot check their code actually compiles.

    Preview is your friend.

    Do not get me wrong, I find your dialogue with "trtrwtf" quite insightful and worth while reading - just having trouble actually reading it. Thanks.

  • Jimbo (unregistered)

    don't lull a bunch of morons into a false sense of capability by using something like Java.

    this.

  • Crikey (unregistered) in reply to eViLegion

    I can smell the pretentiousness from here

Leave a comment on “A Bad Leg”

Log In or post as a guest

Replying to comment #:

« Return to Article