Slashdot Mirror


Resources for Teaching C to High School Students?

mctk asks: "I'm a high school teacher who, disappointed with the lack of computer science in school, has promised to teach a few motivated students programming after school. As an enthusiastic novice with three semesters of C under my belt and a few side projects worth of experience, I feel competent yet ignorant. I would really appreciate suggestions for resources on C that are written to be accessible to high school students and contain lots of ideas for activities. Perhaps you've had success with a series of books that spans beginner to advanced? Do you have any activities you would recommend? How would you map a student's first year of coding? I welcome any and all suggestions. While we're on the subject, is there a brace style that is most standard in the industry?"

166 comments

  1. Don't teach the language by simm1701 · · Score: 4, Insightful

    Don't try to teach the language, any more than you teach someone how to use a pen when writing.

    Teach the mentality, the methodology of problem solving.

    Teach basic algorithms, data structures and coding theory - give them an understanding of where the libraries they are suing will come from.

    More importantly for modern world working teach colaberation, give them a real group project to do, each of them writing different interfaces or different parts of an interface for a whole program (something like a simple game such as tron is ideal for this)

    By doing all of this the language becomes almost incidental - which is really what you want, who knows what the demand for C, C++, javam C# will be in a few years time, but learning the right methodology and colaberative practices will stand them in good stead for years to come.

    --
    $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    1. Re:Don't teach the language by Rakshasa+Taisab · · Score: 1

      Yeah, cause someone who has had 3 semesters of C really knows how to do teach about data structures...

      Pretty much every popular language around uses similar syntax to C, so I'd say just get them to make something trivial, and then correct the obviously ugly and brain-dead code that emerges. It's kinda like teaching someone to play go, just make them used to the shapes and sequences that emerge. Afterwards they can learn the more complex concepts.

      --
      - These characters were randomly selected.
    2. Re:Don't teach the language by Bones3D_mac · · Score: 3, Informative

      I definitely agree with the parent post. Without understanding things like basic algebra or how to plan out an algorithm before even coding it, you won't get past "Hello, World" with most of them. You can't assume they'll already know this stuff or have any programming experience.

      Try a few exercises away from the computer where the students can learn without the pressure of a blinking cursor demanding some kind of input from them right off the bat. Look at things that are popular in their culture such as games and have them try to break the rules of each game down to instructional steps, as well think about the thought process that goes into planning a move, and then explain it in instructional terms... all of it in plain english.

      Another good one, is learning how to sort various forms of data, along with the numerous ways one can achieve a sort (such as the bubble sort). A great physical example of sorting are things like the Towers of Hanoi puzzle (the one with the disks and three pegs), or a deck of playing cards.

      Pushing an entire programming language on someone before they know the basics of how programs function will only scare or frustrate them... especially when they have the prospect of a failing grade looming overhead.

      Get them thinking outside the box before putting them *in* one.

      --


      8==8 Bones 8==8
    3. Re:Don't teach the language by Mr2cents · · Score: 1

      But if he knows C, that is a good candidate to teach them the algorithms with. There's a great book I read 10 years ago: Algorithms in C by Robert Sedgewick. You should really check it out. I mean it, if you're not an experienced programmer (as I was 10 years ago), it will really open pandora's box. Linked lists, pointers, recursive algorithms, it all becomes clear. I really recommend it.

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
    4. Re:Don't teach the language by Anonymous Coward · · Score: 0

      For the love of God, don't turn it into a Data Structures and Algorithms class. These are high schoolers who don't have any programming experience, and probably the math experience, to make that kind of a course practical. I'm not saying they won't be able to learn it -- they probably can. But since this is an afterschool program, it should probably be a little more "fun".

    5. Re:Don't teach the language by MindStalker · · Score: 1

      give them an understanding of where the libraries they are suing will come from.

      SCO stop teaching our kids for pity sakes!!

    6. Re:Don't teach the language by Mr2cents · · Score: 1

      I had a great time reading this book, especially the part about recursion. I wrote a program to draw a ruler recursively and some fractals. It's really not as boring as you think.

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
    7. Re:Don't teach the language by simm1701 · · Score: 1

      oooops.... hmmm rather bad first post typo there

      s/su/us/

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    8. Re:Don't teach the language by Anonymous Coward · · Score: 0

      I clicked on this story to post pretty much exactly what the parent post says. I'm TAing a first year computer science course at a pretty big university, and the one thing that really bothers me is the focus on the language being taught, instead of general problem solving. the students are hung up on things like what is a static method, or how to read and write files, while they still don't really understand the difference between an if statement and a while statement. teach a high level pseudo code, and just solve problem after problem. have them write little programs in pseudo code over and over again, until they can write out algorithms in a plain language that they understand, and then maybe teach them how to translate that into something a computer can understand.

    9. Re:Don't teach the language by somersault · · Score: 1

      Hmm - my dad taught me about linked lists before I went to Uni, but I don't see why a guy who has studied C for a year, done some 'side projects', and has the guts to start teaching a class on it, shouldn't know about data structures - or at least if he doesn't know about them, he will be able to understand them fine. He just wants to know if there are any resources that people would recommend..

      --
      which is totally what she said
    10. Re:Don't teach the language by somersault · · Score: 1

      Should point out there that I can't remember when I started learning of data structures in uni, because I knew most of them before uni.

      University actually stopped me coding because I started spending my time with friends in the evening rather than coding bots (AI type, not cheats) for CS :p I know I have good debugging and problem solving skills, though I haven't been keeping up with languages and web technology. If I had the chance to teach anyone I know how to code I'd probably find it a lot of fun, and it would give me a chance to get back into it without sacrificing any social stuff. I wonder if my girlfriend would be interested :D

      --
      which is totally what she said
    11. Re:Don't teach the language by sk8king · · Score: 1

      I too remember that book. Lots of interesting chapters at a level you never hear about these days [outside university]. Lists, line intersection, string searching, random numbers etc. Everything you see in a book store [normal book store, not post-secondary education book store] is all about teaching yourself something in 24 hours or something like that. That book provides a lot of meat and potatoes....gravy comes later.

    12. Re:Don't teach the language by Red+Flayer · · Score: 1
      but learning the right methodology and colaberative practices will stand them in good stead for years to come.
      I'm not sure if whether people yell at their soda has anything to do with how one should best code in C or any other language.
      --
      "Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
    13. Re:Don't teach the language by Marxist+Hacker+42 · · Score: 1

      And don't forget the importance of Dungeon Style Adventure Games. No better way I know of to teach data structures, pointer math, and basic object orientation all in one shot.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    14. Re:Don't teach the language by An+Onerous+Coward · · Score: 1

      I do like a lot of your advice. The collaboration idea is frankly fantastic. I also like the idea of focusing on general concepts that will be applicable to any language they may run across.

      But when you're learning how to write, you do need to learn how to use a pencil. It took my teachers months to break me of the habit of simply clenching it in my fist. In the same way, there's little point in teaching kids how to solve high-level, abstract problems if you don't also put a lot of effort into teaching them how to express the solution in a way that the computer can understand. Especially with C, this can involve a lot of painful, frustrating effort.

      Pointers alone might take a few months to nail down.

      I would suggest Python as a preferable language, if the goal is to spend your time teaching concepts rather than the language itself. Just find an editor with syntax highlighting, that actively helps them deal with the whitespace thing, and you're ready to roll. It's not necessary to delve too deeply into the inner workings at first (as in "Why am I writing #include "stdio.h"? What's the point of having a separate .h and .c file, and why am I supposed to wrap the .h with an #ifdef but not the .c?" That's all stuff that you have to get out of the way before you get too far beyond "Hello, World".

      Also, I can't overstate the value of having relatively high-level data structures like lists and dictionaries right there, available from the very beginning.

      Finally, I think it's great to start off with a language where you don't have to worry about mismatched parentheses and missing semicolons. Yes, most languages require you to think about those things, and it's no great advantage after the initial learning stage. But they're two less things to think about when you're just starting, and it's good to smooth out the learning curve.

      But the guy was asking about C, which makes it difficult to teach a lot of high-level concepts (I'm especially thinking of objects and classes, which are mainstays of most languages). I doubt it would be hard for him to switch, and he'd still have a huge advantage because he has programming experience that his students lack.

      --

      You want the truthiness? You can't handle the truthiness!

    15. Re:Don't teach the language by mctk · · Score: 1

      I appreciate what you have to say. Definitely I think one of the hardest things for people to understand about computers is that the results seem simple but the workings of the program seem so complex. "We do all that and all it says is 'Hello world'?" It's important to get into the mindset of understanding, not just the results, but the logical arrangement of each little step to get there. Syntax is not the point. That's merely a tool to achieve a bigger goal.

      At the same time, these are self-motivated students, not a graded class. And I need to make sure that they see progress on computers and have the thrill of a working program. There needs to be progress in both areas at the same time. And that is a hard line to place.

      I like your idea of analyzing a game. Perhaps a program that plays tic-tac-toe against you and always ties? Connect four, maybe. Any more ideas? I'm thinking for these, I would make a library of functions for them to use so that they could focus on the logic, while at the same time getting an idea of syntax.

      --
      Paul Grosfield - the quicker picker upper.
    16. Re:Don't teach the language by Marxist+Hacker+42 · · Score: 1

      Don't forget the age-old Text Adventure. It's a natural for data structures, pointers, linked lists, binary trees, data nets, and object orientation. Give them the basic data structure with description pointer, item list pointer (that always blew my mind- a pointer to a list of pointers to a string of chars), four direction pointers (also a mind blower as now you've got a self-referencing object- pointers pointing to other objects of the same type), etc. Plus it's really easy to do in C and gives a lot of satisfaction quickly.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    17. Re:Don't teach the language by Marxist+Hacker+42 · · Score: 1

      Gee, when I went through flowcharts were considered fourth grade computer science material- and that was in the late 1970s. Aren't they teaching basic boolean algebra to kids anymore?

      But I do have a tendency to agree- thus my emphasis on text adventures I've noted previously. Basic IO, a single data structure, and pointers. What more do you need?

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    18. Re:Don't teach the language by Marxist+Hacker+42 · · Score: 1

      (I'm especially thinking of objects and classes, which are mainstays of most languages).

      An object in a higher level language is just a struct in C. A class is just an object that has been bundled with code that acts upon that object. No big deal- basic C can handle this, and there's a darn good teaching opportunity in doing it the long way.

      This will be the final time I'll post in this thread- a text adventure game is an interesting enough exercise that it will take up to a full semester to program, and will teach all of the above concepts when you're done.

      --
      SJW: a person who perceives an injustice, and while correcting it, commits a greater injustice.
    19. Re:Don't teach the language by poopdeville · · Score: 1

      Aren't they teaching basic boolean algebra to kids anymore?

      I presume you mean basic Boolean ring theory. Though a Boolean algebra and a Boolean ring generate the same structures, they are distinct concepts. A Boolean algebra is a lattice that satisfies certain axioms. No other function symbols outside of the meet and join are necessary to characterize a Boolean algebra. A Boolean ring is a ring with some constraints on multiplication.

      Unless you mean the very rudiments of the Boolean Ring operations, they have never taught Boolean Algebra to kids. Lattices are hard.

      --
      After all, I am strangely colored.
    20. Re:Don't teach the language by edwdig · · Score: 2, Interesting

      If you go heavy on the pointers, you will either greatly improve their understanding of things, or completely scare them away. My girlfriend took a class once that essentially covered how to use computer programming to apply engineering concepts. The course had knowledge of C as a prereq, so she asked me to teach her. She really enjoyed programming and kept pushing to learn more until we hit pointers. At first she was ok, until she encountered her first pointer error. Once she understood what happened, she instantly realized all the potential errors and complexity that pointers introduce. At that point, she said to me "How do you deal with this all the time? I could never do that." Shortly after that, the teacher realized that no one in the class knew how to program, and changed the class so that you could do everything in Excel. That was the end of her programming. She wouldn't even consider learning something easier. This was without me ever even implying anything about pointer math. I don't think I ever got to pointers to pointers.

      Anyway, my advice is to delay introducing pointers as long as possible.

    21. Re:Don't teach the language by metalcup · · Score: 1

      suggest you also look at http://www.oreillynet.com/mac/blog/2005/11/learn_l isp_from_mitfor_free.html (LISP) and (from the same article) http://mitpress.mit.edu/sicp/full-text/book/book.h tml (Structure and Interpretation of computer programs) - read the introduction and preface. There are also a bunch of supplemental videos that you could use. Hope this helps.

      --
      "Laziness is an optimisation protocol"
    22. Re:Don't teach the language by An+Onerous+Coward · · Score: 1

      I understand that you can mimic object-orientation in procedural and functional languages. It's a wonderful and illuminating exercise, but one I would be loathe to subject a group of first-years to. If you're going to teach objects, it seems far more straightforward to do so in a language that has a syntax for it. The high level concept is difficult in its own right, and throwing implementation on top of that seems perverse.

      The same goes for data structures. Once a student is comfortable with the idea of using a list or a dictionary in Python, you might teach them how to implement a functional equivalent without referring to a built-in. It seems to me that the focus should be on understanding and using data structures, not implementing them.

      While I fully agree that a text adventure would be a great exercise for younguns, I'm not convinced that C is the ideal language for it. By nature, a text adventure is very heavy on text, and C/C++'s text processing capabilities are about as frustrating and error-prone as they come.

      Folks recommending C as a first language seem to believe that the best approach is to start at the bottom and work up. But I think that presupposes that the students will all be going on to CS as a profession, ignoring both the people who don't have that goal and those who would be scared away by too rough an introduction. With interpreted languages, the understanding needed to write a truly useful program is greatly lowered. This gives students much more motivation early on, and leaves those who won't continue in the field in a better position to actually use their skills to make interesting things happen. With C, an advanced first-year project might be "write a program that solves the Knight's Tour problem." With Python, a problem of equivalent difficulty might be "write a simple RSS client." IOW, instead of starting from the bottom and working up, start from the middle and work in both directions.

      --

      You want the truthiness? You can't handle the truthiness!

  2. Watch out, though... by Channard · · Score: 2, Insightful

    ... plagiarism is bound to be a possibility, especially with access to the internet. I know what when I was doing my C course years back at school, a lot of students ended up borrowing chunks of code from each other. And, in a few cases, taking one listing and just modifying it for their own purposes. And since they moved the code around a bit no-one really got busted. That was before we even had access to the internet, either!

    1. Re:Watch out, though... by Loconut1389 · · Score: 1

      I've seen this same thing and I'm sure it exists at nearly every university- but the more I think about it- if kids know how to modify the code enough to make it different, but do the same, perhaps they're learning something anyway? (not that I encourage plagiarism in the least- but it takes some level of skill to successfully mask plagiarism in programming)

    2. Re:Watch out, though... by Anonymous Coward · · Score: 0

      Its probably why teaching java is a bad thing (atleast if you provide compiled examples)

      I'm not a big fan of Java myself - it just doesn't suit my personal coding style - on more than a few assignments I was given I just decompiled the provided examples, changed the variable names then handed it back in - I got an A but didn't really learn much beyond the fact that I'd rather stick with C

    3. Re:Watch out, though... by FireFlie · · Score: 1

      if kids know how to modify the code enough to make it different, but do the same, perhaps they're learning something anyway? I don't think they'd be learning something by copying each other's code. It doesn't take much knowledge to rename variables, change comments, and change simple lines to other simple lines (var++ to var=varp+1). I could easily make a block of code look and function different without having any knowledge of how or if it works.
    4. Re:Watch out, though... by StupidMBA · · Score: 2, Informative
      ...has promised to teach a few motivated students programming after school.

      It's an after school program. I really don't see cheating as a problem. They're kids who want to learn something: not just get their ticket punched. In a normal school class, though, I'd agree with you - up to a point.

      I could easily make a block of code look and function different without having any knowledge of how or if it works.

      ...(var++ to var=varp+1).

      They could learn a bit if they tried to replace var++ with ++var. Or, if they did this:

      var= var+1; var == var + 1;

      I think you get my point. And hopefully, I got yours ;-)

      I'm still on my first cup of coffee.

      --
      Don't mod me down: I was joking!
  3. I know I'll get modded down for this: by kestasjk · · Score: 5, Interesting

    But don't teach them C. Teach them a language that focuses on how to structure programs without bogging them down with memory management, pointers, etc, etc. A firm understanding of OO would also be much more useful and much easier to grasp.
    There's a reason there are so few resources on teaching C to high school students; it wasn't meant to be taught to high school students.

    --
    // MD_Update(&m,buf,j);
    1. Re:I know I'll get modded down for this: by simm1701 · · Score: 1

      I wouldn't worry so m uch about the choice of language.

      As long as its a relatively strict langauage that doesn't encourage lazy coding styles then its useful to teach it. Having a good understanding of pointers, passing by reference, memory management and basic datastructures will never hurt - even if in later life you leave all of that to the compiler and garbage collector.

      Languages I would consider as teaching tools

      C, C++, Java, Ada, LISP, Pascal

      Languages I would avoid until they know atleast one of the above

      Perl (never ever ever ever let someone learn perl as their first langauge, I'm a perl dev by trade and love the language but please teach them something stricter before you let them near a perl interpreter), VB, PHP, python, javascript

      I've never used C# so I wouldn't know which list to put it in.

      Oh I'd also avoid IDE's, such as visual studio or eclipse. Just use a simple text editor and a compiler, don't let other things get in the way of the simple lessons you will be trying to teach them at first.

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    2. Re:I know I'll get modded down for this: by AlXtreme · · Score: 3, Informative
      Remember that these are kids. More than enough time to learn the nitty-gritty malloc-details or pointer arithmetic. Programming should be fun in order to capture their attention.

      I agree with the OP, C would be a terrible choice for first-time programmers IMHO. You need to keep them motivated, and that works best when the reward-to-effort ratio is high. Python would be a great choice: learn them the basics (forced indenting! \o/), and introduce them to stuff like pygame which allow nice results with very little code. At the end of the semester they would be able to make small stand-alone games. Kids like flashy things.

      For a follow-up course, you could choose to go C/C++. But it would only be of use to those who will eventually get a CS/EE degree, which already (should) have enough courses on C.

      --
      This sig is intentionally left blank
    3. Re:I know I'll get modded down for this: by Psychotria · · Score: 1

      On the other hand, it is possible that the earlier people learn about these things the better they'll be in the long run. C's mem management is far from complicated to learn. Pointers... perhaps a bit harder to learn, but dereferencing is an important topic (not really related to C). In any event, pointers in C aren't that hard and learning them teaches you more than learning how to "pass by reference (for e.g)" (to functions) in other languages. My only reservation about teaching C as a first language is that it's too obliging (to do whatever you want). However, if C is taught in conjunction with good programming practices and design, then why not learn C first?

    4. Re:I know I'll get modded down for this: by iamdrscience · · Score: 3, Insightful

      I disagree, I think Python is a spectacular first language. When you're teaching kids to program it helps to keep them away from the nitty gritty at first to keep their interest. Having to learn a lot of foreign concepts before being able to program something fun is what turns a lot of people off to programming, python gives the instant gratification but is also powerful and flexible enough to teach the concepts of programming. Once a student is in the programming mindset you can move them on to more complex/powerful languages like C/C++ and Java.

    5. Re:I know I'll get modded down for this: by simm1701 · · Score: 1

      Maybe its a difference between the UK and US... my high school taught C to anyone who wanted to join the optional cource in 6th form (equivalent to junior/senior year) BASIC prgramming was used at GCSE though most of us on the course learnt that many years before on C64, Spectrum 128 or even amstrads.

      I know I found when I did the 2nd year of my degree in the US that US college freshman/sophmore courses tend to be on a similar level to UK A levels (at least how they were when I took them, they seem to have gone downhill in recent years) and that to keep pace with my UK university requirements I had to tak mainly senior/post grad courses.

      I think blinding them with too much prewritten libraries is a bad thing personally.

      Let them get used to the old way of writign their own libraries, give them a real grounding in where programming came from, and a real sense of acheivement in knowing that what comes out is all their work, rather than just a few hooks into some one else's library - like learning to cook from raw ingrediants ratehr than using a shake and bake kit.

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    6. Re:I know I'll get modded down for this: by RobinH · · Score: 1

      Exactly, start them on assembly like the rest of us, and let them graduate to C once they've felt the pain. :)

      --
      "I have never let my schooling interfere with my education." - Mark Twain
    7. Re:I know I'll get modded down for this: by melikamp · · Score: 1

      What's wrong with Python? I never used to hack for a living, and my interest in programming is altogether academical. I am a LISP whore, for one. I really prefer Python over both c[++] and Java. It is very much OO and it looks cleaner than either of those. Not flaming, just asking, what's wrong with Python?

    8. Re:I know I'll get modded down for this: by melikamp · · Score: 1

      The availability of libraries is totally irrelevant to the question, only the syntax matters. And, speaking of C++, you can dig up a class for nearly anything. A good first language should have a clear syntax for implementing the vanilla CS concepts, that's all. The concepts are: data structures and objects, control structures, functions, pointers (references), recursion. I agree with you, C[++] is not a bad choice at all, but for a different reason.

    9. Re:I know I'll get modded down for this: by melikamp · · Score: 1

      Never programmed professionally, never taught CS, but really want to agree with you. Python is awesome in that it allows you to start writing simple yet very instructive programs, like sorting, without worrying about #include and other such nonsense (I love C, don't get me wrong, but teaching the first course in CS is not the same as writing HalfLife 2 engine). Python has very clear syntax, and it implements all the bells and whistles of the OO programming.

      The only difficulty I can see is that you would have to explain what an object is first (same problem with Java). That may be a good enough reason to settle for a functional language, like C++ , or the declarative omnipotence of Lisp. Another reason to choose Lisp is that it is easy to grade: just give everyone A+ for being on the path to redemption.

    10. Re:I know I'll get modded down for this: by simm1701 · · Score: 1

      Nothings wrong with python, I think its a great language, though personally I prefer perl. However I do not think either perl or python are suitable first languages. They need to learn something with good in built discipline first. Both perl and python allow bad coding practices far too easily, whereas you can write very good code in them, but its better to learn the discipline first.

      VB is in the above list for a different reason - its full of bad practices and bar being able to create GUIs quickly has very little to redeem it as a formal programming language.

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    11. Re:I know I'll get modded down for this: by tootlemonde · · Score: 1

      never ever ever ever let someone learn perl as their first langauge

      Simon Cozens makes a good case for Perl as a first language:

      There's nothing about Perl that is difficult to understand if presented appropriately; the difficulty is presenting some of the concepts in an appropriate way, and that's a question about how good the teacher is, not the language

      If you want the students to be able to start managing and manipulating data quickly, then Perl is a plausible way to go. Even if you want to teach the fundamentals of computer science, Perl is at least as suitable as any language to illustrate the concepts.

      For students who don't go on to do CS degrees, the language they learn in high school may also be the last language they learn. For non-professional programmers, Perl is the only language they'll ever need. The same is probably equally true about Python, Tcl and other real-world languages so the question may simply be which one does the teacher know the best.

      There are probably no bad languages to learn first, just bad teachers. If the teacher were bad, C would probably not be the first language you would want the students to encounter.

    12. Re:I know I'll get modded down for this: by Anonymous Coward · · Score: 0

      First, no, python, unlike Java, does not require you to teach OOP initially:

      j@turing ~/python $ cat > hello-world.py
      print 'Hello, World!'
      j@turing ~/python $ python hello-world.py
      Hello, World!
      j@turing ~/python $

      See, no objects. When you want to reuse code, introduce functions, then modules... Python is multi-paradigm. You can avoid objects altogether if you really want to, and program in a purely imperative style with functions only. Python also sort of supports programming in a functional style, but its support for programming in such a style is very weak compared to a real functional language such as Haskell or a *ML.

      Secondly, are you deliberately trolling? Since when was C++ a functional language?

    13. Re:I know I'll get modded down for this: by j35ter · · Score: 1
      The only difficulty I can see is that you would have to explain what an object is first

      I dont really see a problem there. If you never used a language like C before, you should have no real problems with basic OO programming.

      IMHO what makes Python a poor language for beginners, is that it does *not* teach them how a computer works. With C you have to know at least some basics about your CPU architecture (Anyone remember the union statement and sizeof()?), and at the same time you can directly teach them the difference between a value and a reference.
      Much easier than using some assembler statements.
      --
      Delta-Mike November Bravo Tango
    14. Re:I know I'll get modded down for this: by melikamp · · Score: 1

      My bad, I meant procedural, not functional.

    15. Re:I know I'll get modded down for this: by simm1701 · · Score: 1

      I've seen (and had to maintain or more frequently rewrite) perl written by people who did perl as their first language - its obvious in their code.

      Yes perl is a great language. Its a good teaching tool as you can do pretty much anything in it, very quickly usually - from low level C style manipulations to OO and regex.

      But perls flexability is its downfall. The difference between what you can do and what you should do is huge. Perl has a very bad reputation for unreadable code (executable line noise) and while experianced perl coders trying to make obfuscated code can come up with real gems, programmers that picked up perl as their first langauge and never learn the difference between can and should really illustrate why learnign a stricker formal language first works much better in the long run.

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    16. Re:I know I'll get modded down for this: by rk · · Score: 1

      "The only difficulty I can see is that you would have to explain what an object is first (same problem with Java)."

      You can program Python procedurally and could certainly get new programmers comfortable and acclimatized to the language without covering OO stuff first. Python is a great language with an excellent object model, but in contrast to Java it doesn't push you to do everything the OO way. As a simple example, Compare and contrast the Java hello world program with Python's.

    17. Re:I know I'll get modded down for this: by Anonymous Coward · · Score: 0

      Why wait the entire semester for the flashy stuff. Teach Smalltalk/Squeak/Alice and get there sooner.

    18. Re:I know I'll get modded down for this: by CronoCloud · · Score: 1

      Why should a beginning (high school) programmer need to know the innards of CPU architecture? Are you trying to turn them off of programming forever? Your approach is what makes people think only super-intelligent hyper geeks can program.

      Make it fast, make it fun, because most of the class isn't going to end up being programmers. That's why Python (plus Pygame, LiveWires, SDL) is being recommended.

    19. Re:I know I'll get modded down for this: by Peter+La+Casse · · Score: 2, Insightful
      Both perl and python allow bad coding practices far too easily, whereas you can write very good code in them, but its better to learn the discipline first.

      This is a key point, I think. Python doesn't force you to do the things that good programmers do anyway. Then again, C, Java etc. let you get away with all sorts of bad programming practices too.

      I think it is easier to explain the concept of "type" with a language that forces you to declare your variables and their types before using them. But, that's a pretty minor advantage, and I think it's outweighed by the many practical advantages of Python.

    20. Re:I know I'll get modded down for this: by Anonymous Coward · · Score: 0

      This may sound stupid to many, but I thank God my first language was Pascal, and I still think it's the best choice for most beginners. Yes it's commercially obsolete, but consider its virtues as a learning language:

      * Pascal is a small, easy-to-learn, clear, easy-to-understand language without a lot of syntactic overhead or confusing features. It focuses on essential concepts more than specific mechanics. It's not frustrating for beginners and can be learned pretty quickly, which mitigates the fact that once learned it'll probably never be used again.

      * Unlike modern dynamic scripting languages, Pascal teaches things like variable declaration, data types, and manual memory management, which are still important concepts and still relevant to traditional compiled languages. I think this is important, because when you learn these things first you understand why they're necessary, and then when you go on to learn scripting languages you have greater appreciation for all the stuff that those languages are automatically doing for you behind the scenes. If you start off with scripting languages I think you'll take these concepts for granted (or worse, really, be oblivious to them altogether), and then when you move on to traditional compiled languages they'll seem stupid for making you jump through seemingly-purposeless hoops.

      * Also regarding things like variable declaration, data types, and manual memory management: Pascal helps you get these things right, whereas C just kicks you in the head when you inevitably get them wrong. Once the concepts and good habits are learned in Pascal's supportive environment, the training wheels can come off easily with C, revealing more insight into the low-level workings but with less trauma and discouragement than if you'd started with C at the beginning.

      * There are still Pascal compilers in active development for modern operating systems (Free Pascal, GNU Pascal, and surprisingly many others), and they pretty much all implement Borland's (Turbo Pascal) clean object-oriented extensions, so Pascal can be used to teach object-oriented programming. Pascal books are abundant, and many of them cover the Borland OOP extensions. (Admittedly there are probably no such books still in print, but the good popular ones such as Walter Savitch's still fill used bookstores, libraries, and Amazon.) There are also a number of decent Pascal tutorials floating around for free on the web, such as the one by Coronado.

      * Pascal is a small enough language, that includes only lowest-common-denominator features, that it maps easily and directly to most other structured imperative languages like C or Perl. So even though a student may never again use Pascal after the initial learning stage, the investment is not wasted because everything learned in Pascal is likely to be directly applicable to their next language. Contrast this with taking, say, Perl as a first language -- student becomes dependent on Perl's relatively advanced features like foreach loops, hashes, regular expressions, or array slices, and then they have difficulty moving to most other languages that lack those features.

      Whatever approach you take, best wishes in this noble endeavor,
      Tom

    21. Re:I know I'll get modded down for this: by kpharmer · · Score: 1, Insightful

      > its better to learn the discipline first

      Sure, if these kids are going to become professional programmers. But if this class is intended to just give them a taste of programming or some simple skills - they discipline isn't the most important thing to learn.

      Actually accomplishing something is important. And doing it with a minimum of distraction and fuss is also probably important. And if this is the case, then python is probably a nearly perfect first language. And since python tends to push you towards a right way of doing things, you will tend to pick up some valuable discplines there anyway.

      I suppose you could also argue that VB might also apply since it's all about just getting things done, but it's so ugly that I think it'll tend to wreck the students for any other languages later on.

    22. Re:I know I'll get modded down for this: by fistfullast33l · · Score: 1

      agree with the OP, C would be a terrible choice for first-time programmers IMHO. You need to keep them motivated, and that works best when the reward-to-effort ratio is high. Python would be a great choice: learn them the basics (forced indenting! \o/), and introduce them to stuff like pygame which allow nice results with very little code. At the end of the semester they would be able to make small stand-alone games. Kids like flashy things.

      Yes, forced indenting is a basic! Okay, let's get real here. Python is a great little language but it's not going to cure cancer. C is a great language on which to build a base because a majority of the languages in use today are based upon it. I learned C before any other language (I just got out of school last year) and I'm so glad I did because it made behavior in languages like Perl, PHP, C++, and Java so much easier to understand. My organization still uses C for much of its production code because it's fast, small, and will never go away. Everyone learns it at some point and most of the legacy code is already written in it. Sure, we're moving the new stuff to more robust languages but the fact is that the majority of the code I write is C.

      To the article poster, I would say that focusing on problem solving, algorithm building, and discrete math might be better. It's important to teach them that really Computer Science isn't about creating pretty widgets but more about the math and engineering that go into the process. Show them interesting problems and let them write applications to solve them. Lisp/Scheme is a great language to learn as well because you can pick it up pretty quickly and do some fun things with it as well. Plus it's a great language to use for algorithm building versus memory allocation and the like.

    23. Re:I know I'll get modded down for this: by Sam+Nitzberg · · Score: 1

      Could someone give me their thoughts - for a high-school student Junior / Senior leve, what would they recommend between C++ and Java? Someone I know is interested in C++, but I'm thinking of pointing him to Java.

      I like the idea of starting with an OO mindset, but haven't myself thought through decisively which I prefer.

      Thanks...

      Sam

    24. Re:I know I'll get modded down for this: by arcade · · Score: 1

      But don't teach them C. Teach them a language that focuses on how to structure programs without bogging them down with memory management, pointers, etc, etc. A firm understanding of OO would also be much more useful and much easier to grasp.

      Oh! How I disagree!

      It's the low level stuff that is fun to learn. When I was in High School - I was programming in pascal with inline assembler. It was fun. It was _Great_ fun. I always wanted someone to teach me C.

      Object Oriented programming don't teach people the nitty gritty details of things - and it's the nitty gritty details that is the most fun to learn. At least it was for me when I was in high school. Learning Java would be like learning Visual Basic - not a lot of fun.

      Yes, they thought us Visual Basic in high school. Ugh.

      --
      "Rune Kristian Viken" - http://www.nwo.no - arca
    25. Re:I know I'll get modded down for this: by j35ter · · Score: 1

      *Uh, Sir...Why do we have to use int? Wouldn't it make more sense justo to use float or double?*

      Forget it, Logo was designed to give you enough distance to the machine. unfortunately it didn't teach kids too much. Assuming that these kids already had some CS lessons, its time to let them learn about how a computer works (remember, thats the point in learning about programming) and they wont learn anything unless they get down to the bottom of the machine.

      --
      Delta-Mike November Bravo Tango
    26. Re:I know I'll get modded down for this: by Anonymous Coward · · Score: 0

      You should get modded up...C is a real-world language that's used for real-world problems. It's entirely unsuited for learning concepts other than "how to program in C".

      If he's still dead set on teaching C, he should still have students spend a few weeks playing around with Dr Scheme. It's free and cross-platform, so no matter what type of computers are available to students, both at home and in the school's computer lab, their initial runtime environment will be consistant. It's a LISP-ish language, so it was basically designed to be a teaching tool. And students get immediate feedback, much more so than C (which has the intermediary compilation step) and even scripting languages (which require you to save the file before running it).

      LISP dialects are great at teaching you to think in a non-linear fashion, which is applicable in all programming environments. If nothing else, exposure to multiple programming paradigms can only improve the quality of the C code that students will end up writing.

    27. Re:I know I'll get modded down for this: by poopdeville · · Score: 1

      Yeah, and guess what Lisp is...

      --
      After all, I am strangely colored.
    28. Re:I know I'll get modded down for this: by poopdeville · · Score: 1

      its time to let them learn about how a computer works (remember, thats the point in learning about programming)

      That's a bald assertion. In fact, that's what is being debated in this thread. There are many valid reasons to want to learn about programming. For instance, as a mathematician, I program to perform computations that I couldn't otherwise due simply to time constraints. I don't really care about what's going on under the hood, and if I did I would have chosen to become an EE.

      I would suggest that the Ask Slashdotter ask his students what they expect from the course. Perhaps your suggestion would spark their interest more than mine. But that's really up to them.

      And as a general purpose sort of plan, I would suggest that the Ask Slashdotter teach a minimal, computationally capable fragment of a high level language like Perl or Ruby -- stressing best practices, as others have suggested. If you go the Perl route, you can use "Learning Perl" by Randal Schwartz et al. I would even suggest that you pick up a copy regardless of the language you choose -- it has many excellent exercises for a beginner.

      Some might ask why I would suggest Perl, of all things. There are a few reasons. The syntax is very clear. (This isn't a troll. I agree that writing unreadable Perl is relatively easy. But unreadable Perl tends to abuse the syntax in ways high schoolers aren't going to know about and are only going to find in "Programming Perl" or usenet). Perl also offers room to grow. You can probably get through "Learning Perl" in 6 weeks if you work at a fairly quick pace and don't cover Regular Expressions and some minutia. But the language is flexible enough to let you and your students figure out what to learn next. OO concepts? Yeah, they're in there, though it'll take about a week of talking about references. Data structures? Sure, though references are necessary. Algorithms? Definitely. Specific problem domains? Certainly, especially if you use the cpan.

      --
      After all, I am strangely colored.
    29. Re:I know I'll get modded down for this: by poopdeville · · Score: 1

      But perls flexability is its downfall. The difference between what you can do and what you should do is huge. Perl has a very bad reputation for unreadable code (executable line noise) and while experianced perl coders trying to make obfuscated code can come up with real gems, programmers that picked up perl as their first langauge and never learn the difference between can and should really illustrate why learnign a stricker formal language first works much better in the long run.

      This is exactly why best practices ought to be taught in addition to the language. I agree that writing unreadable code is relatively easy in Perl. But unreadable code tends to abuse the syntax in ways that beginners won't know about. And, with good pedagogy (like the "Learning Perl" sequence), won't learn about until they're mature enough to know when it's appropriate.

      --
      After all, I am strangely colored.
    30. Re:I know I'll get modded down for this: by TimTucker · · Score: 1

      I'd recommend going with Java, for two main reasons that have little to do with the language itself: 1. Javadoc -- the core APIs for Java are simply better documented. Having an easy means of looking up syntax, etc. for everything cannot be underestimated when trying to learn and experiment with coding. 2. Good, free IDEs -- although there are quite a few good C++ IDEs, there don't seem to be as many that support as many platforms as Eclipse.

    31. Re:I know I'll get modded down for this: by kestasjk · · Score: 1
      But don't teach them C. Teach them a language that focuses on how to structure programs without bogging them down with memory management, pointers, etc, etc. A firm understanding of OO would also be much more useful and much easier to grasp.
      Oh! How I disagree!

      It's the low level stuff that is fun to learn. When I was in High School - I was programming in pascal with inline assembler. It was fun. It was _Great_ fun. I always wanted someone to teach me C.

      Object Oriented programming don't teach people the nitty gritty details of things - and it's the nitty gritty details that is the most fun to learn. At least it was for me when I was in high school. Learning Java would be like learning Visual Basic - not a lot of fun.

      Yes, they thought us Visual Basic in high school. Ugh.
      Oh! How I disagree!

      It's the really low level stuff that is fun to learn. When I was in High School - I was programming in machine code. It was fun. It was _Great_ fun. I always wanted someone to teach me the quantum physics involved in transistors, transistor logic, and the Quine McClusky method.

      C don't teach people the nitty gritty details of things - and it's the nitty gritty details that is the most fun to learn. At least it was for me when I was in high school. Learning C would be like learning assembly - not a lot of fun.

      Yes, they thought us assembly in high school. Ugh.


      I hope you don't mind me editing your post to make a point. What a geek likes, and learns years ago when he attended high school, has nothing to do with what's applicable. I do find logic gates more fascinating than C, but teaching it to high school kids who will almost certainly never use it is pointless.
      --
      // MD_Update(&m,buf,j);
    32. Re:I know I'll get modded down for this: by farker+haiku · · Score: 1

      Teach them a language that focuses on how to structure programs without bogging them down with memory management, pointers, etc, etc. A firm understanding of OO would also be much more useful and much easier to grasp.

      The language you are looking for sir, is Ruby.

      --
      Your sig(k) has been stolen. There is a puff of smoke!
    33. Re:I know I'll get modded down for this: by Anonymous Coward · · Score: 0
      I wouldn't worry so much about the choice of language.
      Me neither, everyone knows VB is best.
  4. You need more... by ForestGrump · · Score: 3, Funny

    You need more of 3 things.
    1. Funding to buy letters.
    2. A better lesson plan so you can aim for something higher than a class of C students.
    3. A tech savvy room of students.

    1. For a class of 30, I would suggest 10 As, 20 Bs, 10 Cs, 5 Ds and 2 Fs. Yes, it doesn't add up to 30, but you should give mostly As and Bs, a couple Cs for those seniors who just want something, anything to take and pass while they transition from HS to college, and the D/Fs are for those who are truly slackers and just don't even give you the half effort.

    2. Sorry, I hate to shoot down others, but you seriously want a class of C students? I'm sure administration wouldn't be too happy with that.

    3. I hate to lay it to you, but I've seen average college students have a hard time dealing with scripting, and teaching programming is thinking differently to a higher level. You said you want to teach a few motivated students, yet you need to be open to everyone who enrolls. I would suggest you have lower and upper level classes. Lower level will teach the basics of how a computer thinks, and how to write a basic program. Those in the upper level, is more independent study and you're there as their troubleshooter, adviser, and teacher for when they need new concepts and get stuck. And while you're at it, make writing a short paper (maybe 300-1000 words) on the project they did. It's good for them to learn documentation, communication and know you're boss.

    Ok, 1 and 2 were a joke, but 3 was serious. If anyone is upset, laugh. it's meant to enlighten your day. god its 3am, and i have a final in 5 hours and i'm only 50% prepared.

    Grump.

    --
    Is it true that more people vote for the winner of American Idol, than vote for the president? -Ali G.
    1. Re:You need more... by Anonymous Coward · · Score: 0

      Good luck - now get the hell off Slashdot and go study!!!

      Remember, procrastination is like masturbation - sure it feels good at first, but in the end you're only screwing yourself.

    2. Re:You need more... by Anonymous Coward · · Score: 0

      yes mom. oh call me at 6 so I have time to get a good breakfast, a nap, and call me again at 7:30 to wake me.

  5. Brace style by simm1701 · · Score: 1

    I'm not sure there is a standard in the industry - or atleast a single standard.

    On your brace style question, about the only agreed thing in the industry is that each dev team/company should pick a standard. Preferably with reasons for each decision.

    Its not just about braces either, what about constants, variables, upper/lower case, underscores, sub routine calls, tab indenting, spaces vs tabs, the lsit goes on.

    I'd recommend that you read Damian Conway's Perl Best Practices (O'Reilly) - not to say that those rules map to C, but for a guide as to sensible reasoning behind such decisions.

    Rather than teaching your class a particular set of rules, why not cover several of the rules or guidelines others suggest, then as a group have them sit down and decide on their "department" coding standard. The excercise in itself will be more valuable than simply saying where to put a curly brace. Quite possibly as a precursor to the group colaberative effort I suggested above.

    --
    $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    1. Re:Brace style by mctk · · Score: 1

      Very good point. Will do.

      --
      Paul Grosfield - the quicker picker upper.
  6. I share your sentiment by A+beautiful+mind · · Score: 2, Funny

    For example, did you know that 99.99% of high school students can't read Perl?. Shameful, shameful.

    [foot icon here]

    --
    It takes a man to suffer ignorance and smile
    Be yourself no matter what they say
    1. Re:I share your sentiment by iamdrscience · · Score: 2, Insightful

      I'm surprised it's as high as .01%, I've never been able to read any Perl I've written.

  7. My experience by the_brobdingnagian · · Score: 1

    The first course where I had to use C there was only a bare minimum of introduction to get started. It was the course Numerical Physics in the second year of university. Almost nobody had any programming experience. The first day we received an introduction to C and we where assumed to know at least basic C things (simple flow control, variables arrays and functions. No pointers, structs etc.). From the start we where graded on the use of comments and you could net get any help if you did not indent your code. I don't know if this method is good for everyone, but I do know a lot of students learned at least decent (for such a short time-span) programming skills. There where even students, who had never programmed before, who went home and started typing in notepad. When they brought there code the next week it almost compiled at the first try. Of course you have students who copy almost all of their code and don't know what they are doing. So my experience is: don't explain everything, just let them start with the bare minimum and let them ask for help and let them solve their own problems.

    1. Re:My experience by Anonymous Coward · · Score: 0

      Rank idiots don't major in Physics.

      You can expect idiots to take high-school programming. Explain everything.

      You'll probably also get a few smart people. Provide a fun way out for them.

  8. Memory by BAILOPAN · · Score: 1

    If you want to teach basic C (such as function calling, variables, and basic expressions), probably any "Learn C in X days" book will do the job. But at that rate, there's not much point in learning C over a simpler language, like Java. Teaching memory organization is essential to anything beyond trivial C, so for high school students, teaching a language that stresses the higher level concepts first may be wiser.

    Many books don't do hardware / memory fundamentals right, if at all, and that might be a problem for finding good reference material. I find that everyone I teach C to runs into the same problems, which are usually either poorly explained or just don't "click" until after a while:

    1. The fact that an array, a pointer (of any level), and an address are fundamentally the same. I.e. not seeing that there's no conversion needed from "type[]" to "type *"
    2. The fact that the '*' character is syntactically confusing: in a type declaration it defines a pointer, in an expression it deferences one. Mistake example: const char *ptr; *ptr = "String";
    3. The fact that a C-style string is an array of characters.
    4. The fact that declaring a pointer does not "create" memory - it creates a variable which holds a (potentially uninitialized) address to memory. Mistake example: const char *ptr; strcpy(ptr, "This will probably crash.");

    As for books, unfortunately I don't know of any off the top of my head. Finding one that clearly explains those issues would be my best choice (Randall Hyde's "Write Great Code" is excellent but is about assembly, not C, unfortunately). Good luck, teaching C can be hard, but leads to a far greater understanding of how computers work. You may end up choosing an easier language.

    --
    If you say "here goes my karma" I will bite you!!!
    1. Re:Memory by Timesprout · · Score: 2, Insightful

      Actually your points are all good reasons why C should not be the language taught. These are high school kids who are going to stay back after to school to persue an interest. Getting them bogged down in the nuts and bolts of pointers and memory mangement will probably only serve to confuse then bore then alienate them.

      Personally I would favour Java as a teaching language because its basic syntax and structure is similar to most modern languages, its OO, easily debugged, requires exception handling, a JDK and an editor are all thats required and there are a plethora of libraries and frameworks available for more complex coding. Perhaps most importantly though they will be able to achieve results quite quickly rather than watch dangling pointers and memory leaks crash their code. When they have the basics of Java and they are still interested then you can show them some of whats happening under the hood.

      --
      Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
      What truth?
      There is no dupe
    2. Re:Memory by disassembled · · Score: 1

      1. The fact that an array, a pointer (of any level), and an address are fundamentally the same. I.e. not seeing that there's no conversion needed from "type[]" to "type *"

      Interestingly enough, this statement is not perfectly accurate. They're really different types with different meanings, but C has a bunch of shortcuts that make them appear to be the same thing in certain (common) situations.

      Let's take an example. Say we have the following declarations:

      int a[5];
      int *p;

      Here are two examples of C's syntactic sugar:

      p = a; // really means p = &a[0];
      p[1] = 0; // really means *(p + 1) = 0;

      These shortcuts make arrays and pointers seem interchangeable when they are actually slightly different beasts.

      To see how they're different, consider the expressions a[1] and p[1]. It might look like these expressions do the exact same thing, but they don't. The first statement reads an integer from the array a, which is allocated on the current function's stack frame (assuming a was declared as a local). The second statement reads a pointer from the current function's stack frame, and it reads an integer from the block of memory to which that pointer points.

      Note that the first expression involves one memory read, and the second expression involves two. The only difference here is the types of a and p--in other words, the array type and the pointer type are not "fundamentally the same".

      By the same token, you're not allowed to assign a pointer to an array (i.e., a = p;). The array has already been allocated in memory somewhere, so there's no way to modify its location by assigning a pointer to it.

      The one place where the array type and pointer type actually are identical is in function parameters. The function types void foo(int *p) and void foo(int a[]) are identical.

    3. Re:Memory by BAILOPAN · · Score: 1

      I don't see what those syntax rules have to do with them being fundamentally the same with regard to memory organization. Your details aren't relevant to the point being made.

      --
      If you say "here goes my karma" I will bite you!!!
  9. Text book by simm1701 · · Score: 1

    In univeristy the text book I used was Data Structures and Algorithm Analysis in Ada - Ada was just picked by the university to ensure no student had an advantage from already knowning the language as it is rather obscure - it is also a very strict language to write in.

    I found the text very good and the same author offers the same text aimed at C (though I will admit I have never looked at the C version, though I suspect it would be similar to the Ada text in most places)

    Data Structures and Algorithm Analysis in C (Second Edition)
    Mark Allen Weiss

            * Published by Addison-Wesley, 1997
            * ISBN: 0-201-49840-5

    It might be worth a look for you

    --
    $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
    1. Re:Text book by rossifer · · Score: 1
      Ada was just picked by the university to ensure no student had an advantage from already knowning the language as it is rather obscure
      This seems like a very strange goal for a university to have. Why would it choose to handicap people who already knew some of the subject material?

      We decided to only teach the series form of differential equations because nobody really uses them in practice and someone who was already applying differential equations wouldn't have any advantage...

      Strange.

      Ross
    2. Re:Text book by iamhassi · · Score: 1

      "In univeristy the text book I used was..."

      Speaking of university, why didn't this high school teacher try looking up the Arts & Sciences department of the local university and try calling some CS teachers to see what books they use or other suggestions on how to teach 1st year CS students? Seems like that'd be a much better option than asking /.

      --
      my karma will be here long after I'm gone
    3. Re:Text book by simm1701 · · Score: 1

      Bear in mind they were tyring to teach coding theory and coding practice - the language is really incidental.

      Going out of their way to make things equal between students is fairly common in UK universities - little differences such as the fact you NEVER put your name on the exam paper and the marks are stadardised across the university. Not to mention 70% being the top grade (but the exam being designed such that if you only know what was taught on the course and you didn't do more research you could only get 70%)

      Very different to the year I did in the states.

      Knowing ADA isn't really a handicap - its a very robust language and if you ever go contracting for the military it will probably still come in handy.

      --
      $_="Slashdotter";$syn="OTT";s;..;;;sub _{print shift||$_};s!ash!Perl !;s=$syn=ack=i;tr+LLEd+BLAH+;_"Just Another ";_
  10. Educate the Youth by WarJolt · · Score: 1

    I had a really strict C teacher by the name of John Perry and I loved him. Make sure that you don't let the write sloppy code or they'll never cut it as programmer. If you don't know the difference between sloppy code and good code then you shouldn't be teaching C. Write a thousand lines of code and hand it to a person who has written plenty of C programs in his lifetime and if he said it's clean then you're golden. Structure is very important. First of course you need to teach the basics. the main function and modularizing code. The structure of the program. Operators and variables and stuff. control statements, loops...ect All these things can be found in just about any basic C book and just about any tutorial online. http://www.its.strath.ac.uk/courses/c/ After you teach them the basics and about pointer, design, methodology, ect... then heres an idea... The best way to get high school students excited about C is to write a game. Unfortunately game programming could be complex for new programmers. A programmer typical is responsible for a small portion of code. So, you write most of the game and have your students write little modules for stuff. For example high score records. Thats pretty easy and only requires someone to know how to edit a text file and sort scores. Describe a function for your students to write in as much detail as possible. After all the modules have been written put it all together. Then when they see they see the game working they have a sense of accomplishment. I think that most of todays students think they want to go into programming because of games. Why not play on their interests?

    1. Re:Educate the Youth by Schraegstrichpunkt · · Score: 1

      Strict teachers are only good when they are experts in the field they are teaching.

    2. Re:Educate the Youth by WarJolt · · Score: 1

      He did write his own book. It's not that hard these days, but at least he went through the effort of doing it.

      Unfortunately it's a bit pricey off amazon, but read the reviews.
      It was much cheaper in the college bookstore.

      http://www.amazon.com/Advanced-Programming-Example -John-Perry/dp/0534951406/sr=8-1/qid=1166185131/re f=sr_1_1/103-8230721-4280618?ie=UTF8&s=books

    3. Re:Educate the Youth by Schraegstrichpunkt · · Score: 1

      I was referring to the submitter. I thought you were saying he should be strict.

    4. Re:Educate the Youth by athena_wiles · · Score: 1
      Re. games and other interesting programs - I agree with this. My CompSci teacher in high school (teaching C++, for the record) taught us the basics (data types, arrays, I/O, some basic algorithms, all that jazz), then let us loose on a series of small projects. These projects included:
       
      - a competition to see who could write the fastest program to compute all of the primes up to 1 million, with a prize for the best results
        - a program to play Yahtzee (we were required to do a text-based version, but got extra credit for writing a graphics-based one)
        - a small, functional database program
        - whatever other projects we wanted to do; I got class credit for writing (from scratch) my own versions of Tetris and Minesweeper... I wrote these from the ground up, but it would have worked perfectly well as a smaller project if he'd written the framework and had me write specific functions

      Having all of these fun little projects to do definitely kept me interested in the class and in the techniques we were learning, so I really do agree that some sort of projects like these are probably a good way to go when teaching high school students.
    5. Re:Educate the Youth by WarJolt · · Score: 1

      I was saying don't teach BAD C. Since the beginning of programming people have written unreadable code. People who don't teach it write just contribute to the problem.

      Actually there was one point that my teacher violated some of the "common coding guidelines" of C. You might find this interesting as I don't often find it in code.

      for (i = 0, j = 100; i j; i++, j--)
      commas can be used in for loops to do multiple things.
      If used in a while loop you only the last expression is checked.

      while(printf("Enter:"),fgets(buf, sizeof(buf), stdin), /* fgets checks for buffer size*/
                                                    firstarg = strtok(buf, DELIMINATORS),
                                                    secondarg = strtok(NULL, DELIMINATORS),
                                                    strcmp(firstarg, "exit")&& secondarg != NULL){ /* if the user typed exit and there was no second argument exit */ /*process options */

      } /* it makes it apparent what the loop does without looking into it. All of the key information is in the header. The parts in the loop block is just the processing.

      And he'd make us use strtok to parse any user input because strtok is the only safe way to process user input. Most people who took his class knew how to use scanf, but scanf can be foiled pretty easily. For example, scanf doesn't check for buffer overruns when copying strings. If we were getting a integer as one of our tokens we would use strtol to convert it to an integer and he would make us check if the *endptr == '\0'. He wasn't a fan of scanf, but once it was done I couldn't think of a single way to break my code.

      He wasn't even happy with his own code, but that makes for clean code i think.

  11. Mod parent funny!! by Anonymous Coward · · Score: 0

    Please someone mod parent funny - that article nearly had my in tears!

  12. A Book on C by Psychotria · · Score: 1

    "A Book on C". Apart from the errors in this book (which, when I last looked about 7 years ago, are few), I think it's great. The errors, by the way, will be picked up by the better students. I'm not convinced that C is a great first language, but if you insist, I reckon that book is good (if it's still available). Then again, lots of stuff is written in C and available as source code; so, in that sense, C would be a great first language. There's not many current applications written in, for example, modula-2 that have their source available. Taking into account "learning by example" then C is, in my opinion, top of the stack.

  13. Practical C by iamdrscience · · Score: 1

    When I learned C it was as an independant study in high school and I used primarily O'Reilly's "Practical C". I thought it did a pretty good job, but I also used variety of other books like K&R. The most useful book for me besides Practical C was "C: A Reference Manual" by Samuel P. Harbison and Guy L. Steele, but as the title implies, it was not a book about learning C.

    If you're talking about programming C++ and not straight C, I think a good book would be "How to Think Like a Computer Scientist". It's a free text (FDL) that has a versions written for Java, C++ and Python. I think it's a great text for beginning programmers because it teaches some of the fundamentals of computer science. Not a great text for college CS classes, but perfect for high school students or intro to programming classes.

  14. K&R2 by Schraegstrichpunkt · · Score: 1

    1. Realize that you are only qualified to do so much with this. Your job here is to facilitate these students' independent learning, rather than to try to teach them C programming, since you barely understand that yourself.

    2. Get a few copies of The C Programming Language, Second Edition, by Kernighan & Ritchie. Aside from the ISO standards, it's the authoritative source for C, and it describes the language in detail without a lot of fluff. As a side benefit, it will also familiarize them with the K&R coding style (but this is by no means important at this stage).

    3. Give them some existing code (read: games) to modify. They'll learn a lot just by looking at what other programmers have done, and it they'll be able to see results quickly, which is important if you want to maintain their interest. If you're using Linux, there's a ton of open-source code they'll be able to use. If not, you might be better off with something like writing Quake II mods.

    4. If it's not fun, you are failing.

    1. Re:K&R2 by Schraegstrichpunkt · · Score: 1

      Regarding game programming, I should also mention Allegro, and allegro.cc.

  15. use K&R's book (2nd ed) by KeyserDK · · Score: 1

    currently studiying Computer science So I could have forgotton how hard it was (is?) :)

    Anyway... K&R's The C programming Language
    1) Cheap
    2) Most importantly it's clear,short and to the point.

    This is believe, suits motivated students better than crappy 1000+ pages books ( American style! ;) )

    The first chapter(s) are fine as an introduction.
    As a plus they can actually use it to look stuff up, instead of just tutorial oriented books.

    It's clear and short. And gives you the basics

    Ofcourse you could argue that the problem is teaching them C, but i don't believe it matter that much. Really.

    --
    still reading?
    1. Re:use K&R's book (2nd ed) by Anonymous Coward · · Score: 0

      K & R are Canadian and American, respectively, and their "The C Programming Language" was published by an American publishing company. Do you have any reasons for saying that the American style is +1000-page crap, other than some preconceived prejudice?

  16. Pascal... by Anonymous+MadCoe · · Score: 1

    I was tought Pascal (allthough I allready know some stuff atvthe time, like BASIC and Z80 Machine code). And I would suggest teaching them Pascal using "Programming by design" by Miller & Miller.

    I found that to be an excellent course...

  17. Teaching books, not reference. by Aladrin · · Score: 2, Informative

    Some posters have actually recommended that you teach from reference books, instead of books meant to teach the language. I'm amazed and appalled.

    http://www.deitel.com/books/chtp5/

    Deitel & Deitel books are amazing. The professor I had in college used them to teach, even though the college didn't actually approve them. Even the worst of the students was able to understand the examples and follow along. I was amazed that he managed to teach the worst few the basics and they could actually write programs. Seriously, they had NO business trying to learn programming, and they were learning.

    But don't just hand them the book and tell them to have fun. Take each chapter and make a lesson from it, as if it wasn't in the book and you had made it up yourself. (Obviously, don't read from the book.) You'll automatically say it differently than the book did, and when they go back to the book, they've got a second way of looking at it automatically.

    And make them type in the code. Don't let them copy it from the CD. If sounds stupid, but it definitely helps them remember what's going on, and the mistakes they make in typing will help teach them to debug.

    --
    "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
    1. Re:Teaching books, not reference. by FireFlie · · Score: 1

      I have not read this particular book, but I agree with you on your first point. Personally, if I'm going to work in a language that I'm not familiar with, I want a good reference book so that I can look up the syntax where necessary. These kids are going to be learning the fundamentals of programming as well as a little bit about a language. A reference book will not suit them because where I would be irritated by constant explanation of simple concepts, they will need them as much as they would need the code examples.

    2. Re:Teaching books, not reference. by afidel · · Score: 1

      Yep, I (re)learned C and C++ from Dietel & Deitel books as a high school student taking college courses, we had a number of high school kids in my class and none of them got overwhelmed. I attribute this to a good professor and the approach of the books. We even completed about 120% of the course in the C class because the approach allowed people to learn in such a way that there was little need for reexplaining concepts which was not true with the text the course was originally designed around.

      --
      There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
    3. Re:Teaching books, not reference. by holistah · · Score: 1

      Interesting, but I taught myself solely from reference books... in fact, I can't learn from "teaching" books, they are too boring and go too slow, even the "advanced" onces... But maybe that is the difference between teaching yourself and teaching others...*shrug*

    4. Re:Teaching books, not reference. by Aladrin · · Score: 1

      Teaching books are meant as a first step for people with NO idea how a computer 'computes' and what a programming language is. If you were exposed to this information, even just gradually, reference books may indeed be the way to go.

      I started to learn to program in 4th grade, had a summer class in 6th grade, and taught myself from there. That was enough intro for the 'teaching' books to be useless and the reference books to be boring. I learned the major portion of my skills online using search engines. (Google wasn't very popular yet.) Even now, I find reference books pointless as I can get all the information online, and get tips from other users at the same time, just by searching Google.

      But you can't assume kids in highschool have been exposed to this and try to teach them from reference books. It'll be ugly.

      And yes, there's a huge difference between teaching yourself and teach others. Especially if the teacher isn't very confident in their ability. (As in this case, where they admit they are a 'novice'.)

      --
      "If you make people think they're thinking, they'll love you; But if you really make them think, they'll hate you." - DM
  18. My suggestion by Curien · · Score: 1

    Use Koenig and Moo's Accelerated C++ to teach modern C++ rather than C. Modern C++ (meaning C++ written in a modern style) does not require much memory management or other "nitty-gritty" stuff, but it allows the students to learn in a framework in which such bookkeeping tasks can be introduced with minimal fuss when appropriate. Also, the book is succinct, thorough, and pedantically correct.

    --
    It's always a long day... 86400 doesn't fit into a short.
  19. in high school... by defy+god · · Score: 4, Interesting

    In high school, I took an AP Computer Science class that taught C++. If I understood then what I understand now, learning C++ would have been a whole lot easier. My teacher focused too much on the language instead of concepts.

    After several failed attempts at trying to learn how to program, I finally understood basic concepts such as variables, integers, arrays, etc. I then took a more basic computer science class, "Algorithm Design/Problem Solving," that used the book Programming Logic and Design. This book does not use or concentrate on any specific programming language. All our assignments were done in pseudo-code and we had to show the logic of what we wanted accomplished. I have to admit it was a lot easier trying to convey the logic without having to worry about the syntax.

    It's been a couple semesters since I've taken that class, without any programming in between, and now I've picked up The C Programming Language. I am currently half way through the book and ,I must say, I finally understand and appreciate the concepts being taught. I wouldn't quite recommend this book to the pure beginner, because it assumes knowledge about basic concepts such as variables, compiling, etc. The book, at a little less than 300 pages, is written and presented much better than the 1000+ page programming books I've run across.

    If I were back in high school, I would love to have these concepts introduced at a gradual progression. Basic programming concepts -> Logic & Design w/ pseudo-code -> the actual language of choice using an easy to learn (30 minute intro) compiler. Of course, hindsight is 20/20 and I'm not too sure if I would have paid as much attention to the first two concepts. Since you are teaching in a high school, I take it you have 2 semesters to teach the class. Perhaps dedicate the first half of the first semester with logic. You can have them play different logic games and tie that in with the lessons.

    Creating a good foundation makes learning and teaching a whole lot easier.

    --
    hackers of the world unite!
    1. Re:in high school... by jbarr · · Score: 1

      I really think that in high school (and even earlier) the goal for Computer Science (and I guess most other fields) should be to get the students to develop a passion and desire for wanting to know "why" and "how" things work. The specifics of a language sometimes get in the way of understanding the underlying concepts. By focusing on the concepts, you lay the groundwork to be successful with pretty much any language.

      When I was in high school, I took one of the first-offered AP Computer Science courses in 1984. Its theory was taught using the Pascal language. The instructor actually used excerpts from Donald Knuth's "The Art of Computer Programming" series. In retrospect, I can't believe we actually understood what he was teaching! Though we were learning how to program in a language, more importantly, we were learning concepts--concepts that were really language-independent. I admit that at that time, I struggled with the language idiosyncrasies at times, but learning the concepts was what paid off later in my career.

      --
      My mom always said, "Jim, you're 1 in a million." Given the current population, there are 7000 of me. God help us all!
    2. Re:in high school... by SQFreak · · Score: 1

      It seems to me that the fault was your teacher's for not teaching basic concepts, as opposed to the language's. If you were taught the basic concepts, C++ is a fine first language.

      If you want an introduction to OOP, try Karel the Robot. If you want a C++ book, consider Maria and Gary Litvin's C++ for You++ . (Absolutely ridiculous title, I agree, but you learn what you need to know without getting bogged down in the nitty-gritty.) It's designed for AP Computer Science, but you certainly don't have to teach to the test.

  20. One word... by Anonymous Coward · · Score: 0

    Ritalin.

    Most high school students I've dealt with don't have the patience to simply pay attention during programming classes... they're all too busy daydreaming that they're game programmers.

  21. Nothing, I think by WgT2 · · Score: 1

    Nothing! They get C's on their own!

    Am I in the wrong forum?

  22. Ontogeny recapitulates phylogeny by Anonymous Coward · · Score: 0

    Show them hell of assembly language programming (that will teach them computer architecture in sufficient detail) then offer them salvation of C. They'll understand it in a click.

    Repeat with C in place of assembly language, C++ in place of C.
    Repeat with C++ in place of C, Java in place of C++.
    Repeat with Java in place of C++, C# in place of Java.

  23. Webcast by mondoterrifico · · Score: 1

    Berkeley Machine Structures first 8 lessons or so provide a quick and dirty intro to C.
    http://webcast.berkeley.edu/courses/archive.php?se riesid=1906978347
    Yeah it might be over their heads, but you should be able to watch it ahead of time and glean enough understanding to show it to them.
    Dan Garcia, who i think is currently teaching it is also a great and entertaining prof.

    1. Re:Webcast by Anonymous Coward · · Score: 0

      Thankyou for the links, though the service seems down at the moment.
      Any chance to get a downloadable version of the videos? That would be useful
      on bus/train trips.

    2. Re:Webcast by mondoterrifico · · Score: 1

      http://all-streaming-media.com/record-video-stream /all-streaming-video-recording-software.htm
      Here is a page listing software for either recording the stream or downloading it. I have personally only used HiDownload, which works perfectly for downloading real audio streams.

  24. Build foundations and generate interest. by smartr · · Score: 1

    I'd imagine many high school students will not be very interested or they might be turned off by what they perceive as something that will not be useful to them. I would argue it might be best for a highschooler's first programming class to spend a good bit of time initially going over all the various things that they themselves find interesting (perhaps you could run an anonymous survey on what they would like to do with programming). Maybe they want to hack or program games or start the next google... You should further emphasize and demonstrate that C is an excellent language to learn for both practical uses and similarities to other languages. You could dazzle them at first by showing them things like game programming, security (focus on perhaps decryption/encryption and viruses), robotic vision, databases (emphasis on size and predictions via data mining), robotics, etc... not to mention computer related jobs, the big companies pushing them, and all the money behind it. If interest seemed generally low, you could even test them on their knowlege of such things, or do a week of group presentations on various points of interest.

    Next I'd say foundations are of key importance. They should refreshed / taught on what integers vs. real numbers are and how the computer emulates them. They should be taught binary, and the concepts of different base numbering systems. They should be given a refresher on order of operation, and also taught the modulus operation. Either get them on a simple ide, or set them up with a good simple text editor like editpad and an installed gcc compiler. Get them to code Hello World, get them to code some mathematical operations, get them to code something that takes input(input to give them that power, not confuse them with memory addresses)... Go through the different variable types; go through the core of structured programming: if/else/while. Maybe you could craft a program with such a crafty structure it would take some understanding in terms of getting it to exit and return the right result...

    I've gone on longer than I should, but a good late project could be to have them make a small and simplified old school text based adventure.

  25. think of the children by Zoxed · · Score: 1

    > But don't teach them C. Teach them a language that focuses on how to structure programs without bogging them down with memory management, pointers, etc, etc.

    My thoughts exactly: think of the children.

  26. Newsgroups by Anonymous+Brave+Guy · · Score: 1

    In addition to the book recommendations, you might also like to introduce your students to the relevant Usenet newsgroups, particularly alt.comp.lang.learn.c-c++. There are a lot of people on these groups willing to help out newbies with genuine questions, and the level of understanding and correctness is much higher than many other resources (including a lot of the books you'll find in a store). Usually, all they ask is that students make a genuine attempt to solve a problem or read up on a subject before asking questions about it, and since you said these were keen students that shouldn't be a problem.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  27. What do you want to accomplish? by v1z · · Score: 1

    I'd say python, or a similar language with a good interactive shell, and similarily equipped with with poweful libraries would be much better, because it would allow the kids to actually do usefull stuff.

    On the other hand, if you want to give them a feel for how the computer "really" works, teach assembly programming. C has a place in modern programming, but I think it's a bad choice for a first language.

    For just about any language, you can demonstrate basic concepts, and give such thrills as being able to print out your name 10 times etc. But for moving on to doing really cool stuff that you can show your friends, such as consuming rss, doing interactive 3d etc ... python would be an almost perfect fit, especially paired with a couple of modules/packages like http://www.pygame.org/ and http://ipython.scipy.org/.

    Java comes a close second, but even using a tool such as http://judo.sourceforge.net/ or http://www.bluej.org/, java requires much, much more setup pr project to get up and running. Additionally java has no transparent compilation, which means you're stuck with the write-compile-test-cycle, rather that just write-test-change-test...

    Another alternative would be http://www.squeak.org/ and/or http://www.opencroquet.org/. But it's a pretty steep learning-curve going from c to smalltalk, IMNHO. You're students should have an easier time of it, though.

    Give some thought to what platform you and your students will be working on, too. For Mac OS X, I suppose objective-c might be a good place to start. On linux, I'd go with python, on windows, either python or c#.

    The one good thing about c, that is also true for assembler *and* python, is simplicity. You don't *need* an IDE to get from idea to working program. Programming java with notepad and javac very quickly becomes difficult to manage, due to classpath-issues. But with c and assembly you'll still need linking for anything but the most trivial programs -- another win for python (or perl, ruby tcl, lisp etc).

    1. Re:What do you want to accomplish? by Mr.+Shiny+And+New · · Score: 1

      I think the difficulty of programming in Java without an IDE is overstated. Sure, an IDE helps tremendously and I wouldn't work without one, but for learning purposes students will most likely focus on the basics. There are tons of interesting learning problems they can solve with the Java class libraries that are part of the JDK, from basic algorithms and data-structures to GUI programming. I would recommend that students use a text editor that does syntax highlighting (my favourite is jEdit), but using something like Eclipse may be overkill. However, given that Eclipse is a high-quality, and free, IDE, it might be good to use it as well. But I'm part of the camp that thinks students should start without an IDE, and graduate to using an IDE once they understand what they are doing.

      In any case, I think programming in C and assembly is a bad choice for beginners, unless they are seriously determined, focussed, and intelligent. There are too many details re: memory organization, string manipulation, etc, and these details will distract students from more fundamental issues such as program structure and control flow. The only advantage C has over Java is that you don't need OO to program in C, and OO complicates things further. You have to walk before you can run; OO is usually superior to procedural code but Java's "pure-OO" mindset makes it annoying for procedural tasks at times, and this is something that will also distract and confuse beginners. But I think this is a much smaller problem than malloc/free, pointers, pointer math, and the lack of Strings in C.

    2. Re:What do you want to accomplish? by Anonymous Coward · · Score: 0
      If you want to teach people to program and the high-level ideas to start, there is no shame in using an IDE.

      In which case, for Java, I would really recommend Netbeans. Installation is fairly easy, people with advanced needs can add libraries and classpath stuff via the GUI, and for beginners they can just create a new project, edit the initial file, and click the run button, and off it goes.

      The one good thing about c, that is also true for assembler *and* python, is simplicity. You don't *need* an IDE to get from idea to working program. Programming java with notepad and javac very quickly becomes difficult to manage, due to classpath-issues. But with c and assembly you'll still need linking for anything but the most trivial programs -- another win for python (or perl, ruby tcl, lisp etc).

      Since when was linking and compiling the biggest part of programming? IDEs exist for three reasons. One is for productivity gains, the second is aesthetics, and the third is that being able to do everything through a terminal says more about your skills as a system administrator than as someone who turns algorithmic ideas into reality. Sure, you could write that essay with a pencil, and it does take a while to set up that computer with Word or Openoffice, but does using pencil and paper really relate to composition skills?

      And what do you mean by "transparent compilation"? (Google results suggest that's not something I'll find in any glossary.) I assume what you really mean is that Java isn't interpreted like PHP or Python, so that you can't halt execution and then start feeding it manual commands whenever you want?
  28. Flamebait? by tfinniga · · Score: 1
    While we're on the subject, is there a brace style that is most standard in the industry?

    First, C is a horrible language to learn on. Try something like Python or Ruby. There's a book out there that teaches Python where every project is some type of game. That's a good one. There's also the free online textbook, How to Think Like a Computer Scientist. Haven't tried that one, but it's free.

    Also, you asked about brace style. Yes, there is One True Brace Style . Unfortunately, no one can be told what The One True Brace style is. You have to see it for yourself.

    On a similar note, I'm surprised you didn't ask whether to use vi/emacs. Or maybe whether to teach on linux or windows.

    --
    Powered by Web3.5 RC 2
    1. Re:Flamebait? by Anonymous Coward · · Score: 0

      +5 Moron

      First, C is a horrible language to learn on. Try something like Python or Ruby.

      Yes because the Windows/Linux kernel teams are such idiots. Your desktop is not in the majority when it comes to computing platforms on this planet. How great does Python/Ruby work on that realtime 64K 8051 or ARM platform?

      You should loose your geek card (If you even have one).

    2. Re:Flamebait? by tfinniga · · Score: 1

      C wasn't designed as a language to teach you how to program. It was designed as a language to write systems software in. It is still perhaps the best language to write systems software in. However, it compares unfavorably to languages that were designed specifically to teach people how to program.

      Now, if the class is mostly projects writing realtime apps/OSs on embedded platforms, go for it, C is the right tool for the job. But he was talking about highschool.

      BTW, I spend most of every day writing C++ code. It's a good choice, because the app is CPU bound. But Python or Ruby are much better learning languages. Eventually, you want to talk about pointers and program counters and machine language, what's actually going on under the hood. But first let them figure out how to get a computer to do what they want.

      --
      Powered by Web3.5 RC 2
  29. A free book to learn CS using Python by bigsmoke · · Score: 5, Informative

    If you want to teach basic programming skills using Python, there's a very nice free book which can help: How to Think Like a Computer Scientist: Learning with Python

    --
    Morality is usually taught by the immoral.
    1. Re:A free book to learn CS using Python by AlXtreme · · Score: 1

      Great tip, thanks!

      --
      This sig is intentionally left blank
    2. Re:A free book to learn CS using Python by Anonymous Coward · · Score: 0

      http://www.htdp.org/ is a much better book, and depending on the level maturity you can go with http://mitpress.mit.edu/sicp/.

  30. A short list of resources by derek_farn · · Score: 1
    The following lists of freely down loadable books contain a lot of useful material:

    The Wikipedia article on C lists some tutorial material.
  31. C IS a learning tool by Iwanowitch · · Score: 2, Interesting

    We had C during our Computer Architecture classes. The fact that it translates easily into assembly and machine code can be a benefit.
    One of the coolest things we did was to write an asm method, write a C program that uses it, compile them with -O0 and debugging info, and then link them together manually, load them in a debugger and see what exactly happens. Not something you should do in your everyday life, but a fantastic experience.
    However, I agree that it's not a language to teach day-to-day programming with, or to start learning to program. There are a lot of better languages for that.

    --
    One CS student VS 893 DOS games: Let's play oldies
  32. Very friendly book for people new to *programming* by Anonymous Coward · · Score: 0

    "Absolute Beginner's Guide to C" by Greg Perry. It covers C, it's conversational, and it's a very gentle introduction for somebody who has not had a whole lot of programming background (this is not to say it's some fluffy book!). Deitel and K&R and all of those books are great books, BUT they're dry as a bone and might not exactly motivate your budding class. I feel that this book is the kind that they might actually *want* to read rather than be the book that they consiously decide to ignore.

  33. Make it Fun: Get everyone a GP2X. by torpor · · Score: 1

    The GP2X is an excellent platform for C development .. its a very straightforward environment, there is very little setup stress, and the results are fun and definitely playable.

    Plus there is a veritable cornucopia of examples and projects out there that students can learn from .. nothing says "fun" more than getting the code, compiling it, running it and seeing it work and play ..

    As for the brace indent question, there is really only one answer: indent -kr -ts4 somefile.c

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  34. My First CS Class by ggKimmieGal · · Score: 1
    My first CS Class in high school was amazingly good. My teacher made his own text book. It had assignments, information about standard libraries, number systems, variable stuff, everything. It was awesome. It also had all of the due dates for the programs. The way he taught the class was, he taught everyone how to write the first program as a group. After that, a couple of us just took off. If you had already turned in a program, you didn't have to sit through the associated lecture. I finished the class in like four or five months. It was in Java, but it was a basic design that could easily be translated into C.

    Some good program assignments I give my CS1 tutees are:
    • Make Change: The user inputs some amount, and then the student says $1.16 is 4 quarters, 1 dime, 1 nickle, and 1 penny.
    • Repeating Program: Force them to play with while and do-while loops by writing a program that has a "Would you like to try again?" question at the end with a y or n answer.
    • STRING MANIPULATION!!! Let me explain. I had intro to computer science twice. Once in Java, once in C. My Java teacher forced us to write tons of string manipulation programs. My C teacher stuck with math. I still use a lot of the tricks I learned from my Java teacher today. Best set of homeworks ever.
  35. Assembler is beautiful by Dareth · · Score: 1

    It is more simple and straight forward than a higher level language. I taught myself using a free book online, Art of Assembly, and later took the class. The book covers some basics of computers and programming that is useful for many languages. We were required to document each line of code. They recommended that we document as we go, but reading Assembler after the fact and documenting it is no harder than doing the same for C++. Many people consider it their hardest CS course, but I would reserve that label for the advanced automata and lanague theory course.

    --

    I only look human.
    My mother is a halfling and my dad is an ogre, so that makes me an Ogreling
  36. I'd suggest OO instead by krenn · · Score: 1
    Why not consider C++ or Java instead? Better to learn to thinkin the OO patterns to start with instead of having to come to it later.Having moved from FORTRAN to Algol to Pascal to C and Ada the jump from an unstructured Language (e.g. FORTRAN) to a Block Structured one (e.g. Pascal & C) was mild. But the change to OO really does take a bit of wrapping your mind around things. The younger guys who basically never learned functional decomposition and block structured programming seem to to do OO more naturally. For me I still have to think, the patterns for C++ after a year or so are only now slowly getting ingrained in my style, I still tend to think the old way and write C in C++ if I don't watch myself.

    The other advantage is that Java and C++ can be had for free with nice helpful IDEs. The Eclipse CDT (http://www.eclipse.org/ ) with cygwin (http://www.cygwin.com/) provides a fairly full IDE (and you can tailor it's key interface to EMACS :-) ). Eclipse also looks to be a fair Java IDE and there is also netbeans (http://www.netbeans.org/).

    As a book I would suggest one I have enjoyed using in its online form, Thinking in C++ by Bruce Eckel (http://www.mindview.net/Books/TICPP/ThinkingInCPP 2e.html). It has the advantage that there is also a second volume that takes you into using more advanced features (fancy templating, STL, and some more complicated patterns) that they can look into or you could use as a follow on.

  37. The language doesn't matter by TVmisGuided · · Score: 1

    I realize I'm probably beating a dead horse here, but I'm feeling compelled to contribute my two cents' worth. (Save up the change for a root beer or something.)

    You could teach C, C++, Java, Perl, Smalltalk, Fortran, or any number of other programming languages, either structured or object-oriented. But if the students don't get some of the basic concepts of building algorithms and flows, all they're going to come out with is the ability to recognize a given language based on the syntax...three out of five times.

    Better to start with giving the students a foundation in the thought processes that go into program development: defining the problem thoroughly, choosing the best framework for a solution, seeing if there's already a solution available, deciding if what's available is better or worse than something "home-brewed", and only then sitting down with pen and paper and starting the actual design. If you want to use C as a foundation language for demonstrating the process, well and good. But, IMO, problem-solving should be stressed over the mechanics of any given language.

    As to the selection of language...again, IMO, C or C++ isn't the best first choice, even though they're de facto industry standards at this point. If they can write good, clean, tight Java code, it's a fairly short step up to C++. If they can write good, clean, tight Smalltalk routines, learning a SQL variant will be a comparative snap. Tossing them into the mix at the C or C++ level, especially as neophyte coders, will send at least half of them screaming for the nearest AOL chat room, and give at least a third of the remainder migraines. Teach them to walk first, then to run marathons.

    --
    All the world's an analog stage, and digital circuits play only bit parts.
  38. Educate the Educator - Resources by Dareth · · Score: 2, Informative

    You have the basic experience to continue learning, and pass on the relevant parts to your students. Some resources I would recommend are the MIT Opencourseware and the Berkeley Webcast.

    These resources provide two similar but different approaches to learning about computers and programming.

    --

    I only look human.
    My mother is a halfling and my dad is an ogre, so that makes me an Ogreling
  39. Go for the K&R by Anonymous Coward · · Score: 0

    I'm a highschool student, and have been programming in C for many years (around five). My best suggestion is to go for the same as most college students; if you want to learn to program in C, just use the K&R. As all of us know, the things that makes CS texts 1000 pages are trying to teach computer science, not the language. Teaching the two together is hard, but if they're smart, they should be able to figure it out. I know there are tons of people smarter than I out there in highschool, so I'm sure teaching two concepts at the same time will be possible. C's a good language too, you don't have to worry about all the fluff you get in other languages, you understand more how a computer actually works, rather than memorizing the library of a language. If you want to teach them about general CS, keep encouraging the math as well. And best of luck to all of them.

  40. Example Exercise by Anonymous Coward · · Score: 0

    My favorite exercise for learning a bit about computing is implementing the following iterated function system:

    f(x) = {2*x     ,  0 <= x < .5
            2*x -1  , .5 <= x < 1 }

    choose x_0 (in [0..1) ),  find x_1 = f(x_0),  x_2 = f(x_1)...x_n = f( x_(n-1) ).

    How do different values of x_0 affect the behavior of f_n(x) ?
    Is this what you expect to happen?

    Hint:  if x_0 = 1/3, x_1 should be 2/3, x_2 should be 1/3, x_3 should be 2/3 and so on;  why does the computer get this wrong?

  41. Consider Their Maths Background by miyako · · Score: 2, Informative

    I think that teaching kids to program in C is a great idea. I started out by taking C++ in highschool, and I'm now working as a professional developer.
    I've seen a lot of comments saying that you should focus less on the language, and more on things like datastructures, algorithms, analysis, and design. I agree that it's important to give some instruction on the basic concepts behind coding, but I think that you're going to have to remember that these are Highschool kids, and it is highly unlikely that they will have the mathematical background to really dig into algorithms.
    I also disagree with people who are encouraging you to teach them languages such as Python. While it's true that there are languages that are much better than C at allowing you to get something impressive from a small amount of code, I think that it's detremental to students in the long run. After all, you aren't trying to specifically get these kids interested in programming, rather they are students who were interested enough to come to you.
    The biggest thing that I think you can probably do to give the kids a leg up is to focus on the lower level aspects of C. Do a good bit on memory allocation and debugging, and spent a lot of time on pointers. If these kids are interested in going on to become programmers, then making sure they have a solid grasp on pointers is probably one of the best things you can do.
    One of the most amazing things about kids is that, when they are cooperative, their minds are incredibly malleable. Take some of the hardest parts of programming, and start getting them to adjust their thinking toward it at an early stage, and you will find that they will become incredibly skilled programmers if they stick with it. Remember that given their mathematical background, there probably isn't a lot of point in trying to get too deep into analysing algorithms, and keep in mind that there is a lot of benefit to learning close-to-the-metal programming and they might not get it in a university (which seem to be focusing on Java more and more). Be sure to keep the assignments fun and challenging, and taylored to the things that they are interested in.
    The last bit of advice is that you should focus on more than just teaching them to code. Get them into the culture as well. In my programming class, for example, we used to have a weekly assignment to read and post to two stories on slashdot. We watched Revolution OS and Pirates of Silicon Valley. Get the kids into the hacker subculture and they will go much further as developers as well.

    --
    Famous Last Words: "hmm...wikipedia says it's edible"
  42. From a college grad who spent 4 years doing C ... by LSU_ADT_Geek · · Score: 2, Insightful

    I did my undergraduate at LSU in Computer Science, where they start off everyone in C. I have enjoyed the language as I have been able to transition to newer, high-level languages easily. Whether this is because of C or the mindset you need to have with C, I think teaching them C is a good way to start. As for materials on learning and working with C, I recommend the following books / websites: 1. C: How To Program by Deitel & Deitel (ISBN: 0-13-226119-7) (http://isbndb.com/d/book/c_a09.html) This is the first book I learned on. The 2nd edition does a real thorough presentation of material with lots of code and visual examples of good techniques. Also, the 2nd edition did a really good job of incorporating library headers and function prototypes, which are harder to find in a book. 2. The C Programming Language by Kernighan & Ritchie (ISBN: 0-13-110362-8) (http://isbndb.com/d/book/the_c_programming_langua ge_a05.html) This is the holy grail of C books since it was written by the original creators of the language. Despite its slim size, both Kernighan & Ritchie do a really good job with making it concise and relevant. I can guaranty that every C developer has this book on their shelf. It also has some information about interfacing with Unix/Linux OS. 3. Data structures and algorithms book in C I am sorry, I really meant to give you the actual book title I used but it is on my shelf at home. You want to find some type of data structures and algorithm book to enforce good design techniques. The biggest problem I have seen when people learn how to program is the fact they learn how to solve a problem only with the tools of the language. This makes them reluctant to move to other languages that don't provide solutions in the same mechanism. By having your students work in a lower-level language like C, they learn how to build the data structures taken care for you in other languages (stacks, queues, trees, graphs, etc) so they develop the mindset rather than a functional dependency. Hope this helps and keep up the good fight!

  43. Free Pascal by truefluke · · Score: 1

    With today's freely available (OSS) Free Pascal compiler it would be easy to get started using Pascal. This compiler not only understands the Borland flavour of Pascal, but it also has flags to compile other modes of Pascal, even Mac.

    But I digress. Instead of teaching the language, teach the concepts, yes. I agree with that. I'm still teaching myself some basic things as a hobbyist, and this language/compiler have helped me come to understand some comp sci concepts, such as: linked lists, pointer management, etc {yes, pascal has pointers, sigh. yes they can be just as powerful}).

    I offer this as an option instead of C. Use C if you want. Use pascal if you want to use something that was designed to HELP teach students, intitially. It's way more powerful than a toy however, Pascal has grown up, it never stopped growing, and now we have a free implementation that works on several platforms.

    Guess I'll get modded down with you.

    --
    spam, spam, spam, spam, e-mail, news and spam.
  44. C is an excellent choice by ciggieposeur · · Score: 2, Informative

    I'm going to buck a trend and say that C is actually a GREAT first language to learn:

    1. It has a simple way to do console and file IO (scanf, printf) that will enable students to write and test simple programs.

    2. It is used everywhere. As students learn more of C, they will be able to access and use the vast array of libraries available to C and go as deep as they want. When I was 16, it was common to learn C in order to start writing games, and then assembly language to make the fast loops faster. Another student learned assembly language in order to debug DOS viruses.

    3. It is completely deterministic when run in one thread.

    4. Its syntax is very simple. There are very few gotchas, most of which can be resolved with extra parenthesis.

    Everyone else saying "pointers suck", "use a simpler language", etc. are forgetting two things about that first programming language. First, no matter what language you start with, it will be difficult to begin programming. The learning curve for Lisp/Python/Java/Ruby/etc. will be at least as steep as that for C for new programmers, and additionally there is little point in teaching OOP to people unfamiliar with structured programming and the problems OOP is meant to address. Second, it is frustrating to learn a language that has little use elsewhere, especially when it is because someone else claimed that it was better to know general concepts than to know a useful language.

    1. Re:C is an excellent choice by shutdown+-p+now · · Score: 1

      One thing about C that is good in this context is that it forces you to think about >em>how the computer will have to execute the code you wrote. With deep knowledge of C, one can often understand the reasons for limitations present in other languages much easier.

    2. Re:C is an excellent choice by Generic+Player · · Score: 1

      "It has a simple way to do console and file IO (scanf, printf) that will enable students to write and test simple programs."

      So do all the other languages people have recommended instead.

      "It is used everywhere"

      That doesn't mean its a good first language.

      "It is completely deterministic when run in one thread."

      Not really. You can write deterministic code in C, but its not like using C just magically makes your program deterministic. And any other language is going to offer the same thing.

      "Its syntax is very simple. There are very few gotchas, most of which can be resolved with extra parenthesis."

      Actually, there's quite a bit of syntax to learn compared to some other suggested languages like lisp/scheme or python.

      "The learning curve for Lisp/Python/Java/Ruby/etc. will be at least as steep as that for C for new programmers, and additionally there is little point in teaching OOP to people unfamiliar with structured programming and the problems OOP is meant to address."

      You can teach people to use lisp or python MUCH quicker than C. Especially if you use a lisp implimentation designed for teaching, like logo. You can teach it to 10 year olds easily. And there's no need to actually teach them OO design/programming just because you are using python.

      "Second, it is frustrating to learn a language that has little use elsewhere, especially when it is because someone else claimed that it was better to know general concepts than to know a useful language."

      I think perhaps you are out of touch with the world high school kids live in. Most would find C frustrating because it has little use for them. Most high school kids aren't interested in writing OS kernels, or device drivers, or system utilities/libraries. Most of them would find python more useful, especially if you show them some of the python web frameworks, pygame, etc. They can do things that interest them (and that do alot more) much easier and quicker with a high level language than with C. This gets them interested in programming, instead of boring them like C probably would.

  45. K & R (1st Ed) by gluteus · · Score: 1

    If it was tough for me, it should be tough for them. Make them kick it old school.

  46. Turbo Pascal by SocialEngineer · · Score: 1

    I would recommend Turbo Pascal, instead. That's what was taught in my high school, and it REALLY helped me gain a stronger grasp on programming concepts. It also has a very similar structure to C early on, so it'll be a good stepping stone for learning the logic required of programming.

    --
    "Better to be vulgar than non-existent" -Bev Henson
    1. Re:Turbo Pascal by urbanriot · · Score: 1

      I second that suggestion. This is how I was introduced to C++ in high school - Turbo Pascal and a little assembly in Grade 11, C++ and more assembly in Grade 12.

  47. Whoa. Slow down. Don't teach C to first timers. by Purity+Of+Essence · · Score: 1

    Some people are going to roll their eyes at this suggestion but if you are trying to teach programming to people who have never programmed before, I'd recommend the old standard from 1981 Karel the Robot: A Gentle Introduction to The Art of Programming by Richard E. Pattis. It's not C, but it is a very clever book that provides an excellent introduction to the concept of programming and why programming languages work the way the do. I'd been programming for 15 years before I'd read it and I still learned a couple things from it. All programmers should read it just for it's historical value.

    --
    +0 Meh
  48. Language not important by Tsu-na-mi · · Score: 1

    You have to change the way they think.

    I have been a developer for the past ~10 years since dropping out of college, and in that time, I have had to use:

    FORTRAN 90
    C
    C++
    Perl
    PHP
    Javascript
    C# (.NET)
    Visual Basic / VBScript (.NET)

    Picking up the new languages is easy, as they all share fundamental concepts and data structures. Teach your students about scalars and arrays, pointers and sorting/navigating through arrays, conditional statements, iteration (do n, for loops), conditional iteration (while, do while), and some basic math.

    The important thing is, once you have taught these basics, you need to make the students learn how to break down a problem's solution into a set of these steps. You need to get them to start THINKING in terms of conditionals, loops, etc. That is the real goal IMHO.

    --
    I've built up so much character I have an alter-ego
  49. so I've been in this situation by Akatosh · · Score: 1

    I've been in this situation. I had a few years experience with C, and the students at my school wanted a C class. I mated it to existing Basic class taught by an experienced professor and mirrored his Basic course exactly... except in C. The professor didn't know C, but he didn't need to because his course was teaching programming using Basic, not Basic. It was trivial to take his course material and port it to C. I just had my C students do most of the same exercises as the Basic students. This was a 'first' programming class for most of these people, so I really didn't get into the more C specific stuff. A problem might have been like: "make a program that takes input of amount/time/rate of a mortage, then generates and prints an amortization table, sortable by column, using only 'for' loops". Same stuff you get in any first programming class, langauge doesn't matter. In all fairness though, I was bad teacher and wouldn't do it again.

  50. Karel the robot by hoggoth · · Score: 1

    First teach them programming concepts using Karel the robot for about half a semester. That will give them an easy intro to the ideas without dealing with any real-world irritations. Then move them over to any decent language like Python, Pascal, a modern BASIC etc. Stay away from C and C++ for beginners unless you want to explain what a segmentation fault is.

    --
    - For the complete works of Shakespeare: cat /dev/random (may take some time)
  51. Check out the ACM K-12 model curriculum by Stradivarius · · Score: 2, Informative

    The industry group Association for Computing Machinery has a model curriculum for integrating computer science into K-12 education. You might find some helpful ideas in there.

  52. Ideas by GrueMaster · · Score: 1

    First, I'd get them started in an area that will capture their imagination: Games programming. My son is taking a game programming class, and he's having fun learning loop controls, collision detection, etc. He recently wrote a program that converts Doom3 character mesh data to XML file format, and another that renders them on the screen. He also ported the game "Blocks" from the TI-85 calculator to Linux from scratch. As to books, Game Programming All in One, 2nd Edition is a fairly good comprehensive book. It covers most of the basics, and comes with a cd with sample code and development tools.

  53. I teach game programming at a community college by stonewolf · · Score: 1

    And, I am certified to teach computer science in high school. And, I am a programmer with over 30 years of experience. I can probably help you quite a bit. You should be able to contact me through slashdot, if not post a reply and we'll figure out how to communicate.

    First off, you are still a very early stage beginner. That means that anything you do will require you to learn *more* than the students learn. I would try very hard to make your classes into more of a guided discussion and collaboration that a traditional lecture course. Get the students to research the areas they are having problems with and teach the class the solutions. Discuss, discuss, discuss.

    Second, reach out to the tech community in your town and find experienced people who can help you.

    Third, take on projects. DO NOT start out by teaching them and if and a for loop. Pick a project and let the students drive the teaching as you lead them through the problem of figuring out how to do the project. I would suggest a simple game or simulation, something the students are interested in. OTOH, there is a serious problem with expectation management. Cloning pong, asteroids, or tetris is a reasonable goal. Cloning WoW is not. :-)

    Pick the right tools. It is important that you pick tools that all the students can have access to. That includes PCs and development tools. Design the course around free tools that will run on cheap PCs. It all depends on what they students have access to. But, you can teach programming on $40 PCs running Ubuntu with completely free tools, or you can teach it on $3000 PCs loaded up with $5000 worth of software. The amount of programming they learn will be the same.

    Stonewolf

    1. Re:I teach game programming at a community college by mctk · · Score: 1

      more of a guided discussion and collaboration that a traditional lecture course.

      Yes. I don't think my post was quite clear on that. I'm thinking of it more as tutoring three students after school twice a week. So this is definitely how it's going to run. And I'll be upfront with them about the fact that I certainly don't know everything, but I know enough to get them started.

      I agree that the thought process and logical structures are more important to focus on than jumping right into the programming, but it's a fine line, because they have to be seeing results to be having fun.

      You suggest a simple game to program, but in my mind, (at least in C?) pong would seem fairly sophisticated for beginning students. Would that be the semester goal to work towards? Is there a different language you recommend that would make it easier to focus on logical structure? (books? I would need to learn about it this winter break) My plans for C was to set them up with libraries that simplify functions. For example, they would use my own output(q) function rather than worry about printf("%d",q).

      What books do you recommend?

      --
      Paul Grosfield - the quicker picker upper.
    2. Re:I teach game programming at a community college by Purity+Of+Essence · · Score: 1

      Maybe consider Game Maker as a stepping stone to full-fledged programing. It's used very successfully in many beginning computer programming courses, and was in fact written by a professor of computer programming. It's drag and drop interface is very easy to use at the start and can teach basic logic, and its scripting language is very C-like and can be used introduce object oriented programming concepts.

      http://www.gamemaker.nl/teachers.html

      --
      +0 Meh
    3. Re:I teach game programming at a community college by stonewolf · · Score: 1

      Writing a game like pong would be a semester goal. A goal they may not reach, but that is OK. If y'all don't get there by the end of the semester, shoot for the next semester.

      One other thing I would change, do not teach C, teach C++. I do not consider either of those languages good for teaching beginners, but you know C and so it is the best language for you to teach. So, why did I just say C++? Well, C is mostly a subset of C++. The basic language is the same whether you call it C or C++. But, C++ gives you access to a much richer set of tools and is a better language for developing complex programs. Just call what you are teach C++ and use a C++ compiler and learn C++ as you go along.

      A text book that I have used for complete beginners is "Beginning C++ Game Programming" by Michael Dawson. For advanced student I've been using "C++ Primer Plus" Fifth Edition by Stephen Prata. Neither book is perfect, but I haven't found anything better.

      Stay in touch,
        Stonewolf

  54. If the license allows it.... by Anonymous Coward · · Score: 0

    I'd give them full credit if the license of the code they used permits them to do so. This is pretty fundemental to programming - noone in the real world writes totally from scratch - and much of any program is Knuth + small wrappers. If they took code where there is a license giving them permission to do so, I'd say they're totally OK.

    OTOH, if they do something like steal GPL code and don't release their distribution (to their teacher) under a compatable license; they should flunk.

  55. OOP is overrated by Nicolay77 · · Score: 1

    Nah, if you want to teach higher level concepts teach them Lisp. That's something that REALLY changes the way you think about programming, forever.

    Patterns are for languages that doesn't support adding higher level constructs based on others.

    Meanwhile, C teaches them how the computer really works without the excruciating detail of assembler, so they can evaluate in an intuitive way the performance of a given algorithm.

    However, C++ seems a good compromise to me. It is multi-paradigm, so you can use objects if you need them, or generic template programming if you need them, or use stack-instantiated simple objects if you need them (try that with Java!).

    Keeping with C++ I second the sugestion of Bruce Eckel. That's the best C++ book I've ever read.

    --
    We are Turing O-Machines. The Oracle is out there.
  56. AP Credit by VWJedi · · Score: 1

    I'm not sure how "serious" your classes will be, but you might consider teaching an AP Computer Science curriculum. The current language used for the AP test is Java, so you would need to get a good understanding of that language before you begin teaching it. If you prepare the students for the AP test, they have the opportunity to earn some college credit (and hopefully they'll take it seriously).

    Even if you don't do a full AP curriculum, there are some good text books written to take HS students with no previous programming experience and prepare them for the test. You might also consider some older texts written when C++ was the AP CS language (1998-2003).

  57. Been there sorta by geekzer · · Score: 1
    As a former K-12 Technology Director who had to support the teachers of those type classes...

    Check on the ACM curriculum recommendations. http://www.acm.org/education/curricula.html and http://acm.org/education/k12/k12final1022.pdf

    Also the College Board. http://apcentral.collegeboard.com/apc/public/cours es/descriptions/index.html

    Due to the fact that the College Board Computer Science AP test is given using Java, I highly recommend that in place of C/C++ as the language framework for teaching the concepts. Any language chauvinism aside, Java tends to be easier for beginners to grasp since it has far few "dark corners" to get into. Those dark corners are invaluable to programmers who need them, but for learning they tend to be counter productive. My son placed out of his first two programming courses due to AP, though that was a few years ago when the test was given in C++. Java is very much derived from C/C++ so you should have relatively little trouble adjusting yourself. You'll also find active online communities of other HS Computer Science teachers so you can find/share resources there, especially for things such as appropriate texts for the earlier courses (the AP courses should use the same texts as nearby colleges) and appropriate programming environments for whatever your computers are running.

    Personally, I suggest that you start students in a simple web environment using a plain text editor, then once the programs become non-trivial, move into either Eclipse or Visual Studio, or at least get a good language aware programming editor. It will take about a week or two to get them used to the environment, but it pays off big time for debugging and general productivity.

  58. You might want to look at Phrogram by HeyNonnyMoscowHerd · · Score: 1

    Hey, I learned C the "real programmer's" way, from K&R version 1 ... but that was more than 20 years ago, and things have moved on :-)

    Something I came across recently is Phrogram http://phrogram.com/. It was formerly known as KPL -- Kid's Programming Languague. It's Windows-only and it's not Free (Libre) but the "express" version is free. The premise of Phrogram is that what got many of us into coding all those years ago was stuff like BASIC on the Apple/Commodore/Atari/BBC/whatever that let you do "coo stuff" easily. Of course, the definition of "cool stuff" has moved on so Phrogram aims to make it easy to do stuff like 2D and 3D game development easily (there's a great demo of flying a 3D spaceship in 30 lines of code).

    I've got no affiliation with Phrogram -- but if you want to get kids hooked on coding, it may be worth a look

  59. K&R... as a resource by whitroth · · Score: 1

    I learned C from K& R (and Turbo C). But... it's written as "you're a programmer, here's a new lanuguage and how to use it", for professionals, and maybe CS students. There should *absolutely* be 75 copies in the library for students.

    On the other hand, it has not "moved on". When I started in CIS, I had two terms of assembly, which they don't get now, by default. That, alone, has helped me debug any number of times: I don't need to know the assembly language of the specific machine, but to know *how* code works and is actually executed. Besides, when it comes down to it, it's one instruction at a time, and C is fundamental to so much of all systems and code. (Quick - what language is PHP written in?)

    And, yes, all the objectionably-oriented programming is nothing more than an attempt to enforce 25 years of good programming style by compiler.

                      mark

  60. When I learned C in high school... by GWBasic · · Score: 1

    10 years ago, When I learned C in high school, on the first day, the instructor handed out a photocopy of a very simple program. Our assignment was to type in to the computer EXACTLY as printed. Many of my peers had difficulty getting their versions to run. I even had a few minutes of head scratching until I found my missing semicolon.

    You give very little information about your students. Do they have any programming experience at all? Are they writing games on their calculators? Did they overhear that "C is language that all the good programmers use?" IMO, I would only teach C to a teenager who's already written a simple video games that are beyond your abilities. (I wrote a simple video game when I was 13 in GWBasic.)

    Now that 10 years have passed, I think there are much better languages that you can teach to teenagers. For beginner programmers, consider teaching them HTML, JavaScript and PHP by having them modify existing web pages. (I learned GWBasic when I was 10 by modifying games that I used to play when I was 5.) For intermediate and expert programmers, use Visual C# or Visual Basic .Net. (Both are very similar.) They're forgiving enough so that casual programmers can get something done; yet powerful enough to allow an expert teenage programmer to create professional-grade games, servers, and multimedia applications. (If only I had C# when I was in high school...)

    In addition, if you teach C#, it's very easy for a motivated student to transition to straight C. C# has very similar syntax, (which will help you because you already know some C,) and it allows programmers to play with pointers. (Ick!)

    If you do decide to bite the bullet and teach C, don't make the mistake that my high school Pascal teacher did... He taught us structures, pointers, and then how to allocate memory. He didn't even mention returning memory, nor did he intend to until I made a huge stink about it in class.

  61. OCaml, lisp, eiffel, or brainfuck by Ingolfke · · Score: 1

    Seriously... start them out on the mostly useless or niche languages so you can seperate the wheat from the chaff. Once they've learned one or many of these languages they'll have no trouble picking up C (plain ole, ++, #).

    Also, use Knuth and only Knuth as your text.

  62. There are only two books by noz · · Score: 1

    There are only two books: The C Programming Language by Kernighan and Ritchie; and Expert C Programming by Peter van der Linden.

    Contrary to popular belief, the former is suitable for beginners - they just require guidance. Do them a favour and don't buy any books that pretend to make it easier: more pages; less content. Most of them are named "C Programminig for {Scientists,Engineers}".

    Finally, steal lecture slides from your local university's first C course. You might also wish to teach them something of a non-procedural paradigm like a functional language (Haskell is cool).

  63. Debugging for high schoolers by AEC216 · · Score: 1

    I if was to teach a programming course of any language, being able to use the debugger effectively is a skill/lesson that is without value. Seeing a program run step by step is a great aid to not only students but "professionals."

    --
    May I please have my frontal lobotomy if I bring back the ashtrays?
  64. Eh? by Anonymous Coward · · Score: 0

    Just how do you write your Perl? Even one-liners can be translated if you break up the statements into something slightly more understandable... :]

    Of course, I know CSS removal code when I see it and I'm not really fazed by a tr/// that changes uppercase to lowercase, so I must be in that .01% to begin with...

  65. High School Class by Tama00 · · Score: 0

    Isnt there a software development class in high school there?? We have one in Australia (NSW) and they taught us the understanding of programming logic, flow charts, data management and all that, but you were required to teach yourself the langauge of your choice. I myself taught myself PHP for the subject and did pretty well. Infact i recommend PHP as a language, because its easy, has C similar syntax, you can make simple GUI's with HTML not hundreds of lines of code, theres lots of good documentation on the web and it very closly resembles C. We had a Major project which we worked on for about a year, and we had to go through the whole structured approch of developing your program, from designs and interviews, flow charts and pseudocode and then to developing a beta doing bug fixes and eventually producing the full project, if your luckly;) the course ran for a lil under 2 years, so i guess thats just how we do it here.

  66. C Robots ? by Anonymous Coward · · Score: 0

    You're probably too young, but back in the 1980's there was a program called 'C Robots'. Essentially your task is to write a program to operate a virtual robot in a virtual world - your robot must search and destroy other robots it comes across.

    Start them off with something cheap and easy - Turbo C is a fairly good IDE and the DOS versions are freely downloadable off the Internet. Set the goal of writing the best robot. Offer a prize.

    There are other variants (C++ Robots for example) but it might spice things up as you could sell the course as a competition - there is therefore another reason for kids to seek your assistance as you could help them win.

  67. Wow! by seebs · · Score: 1

    I was gonna recommend King's C Programming: A Modern Approach, but it's apparently a $100 book these days.

    It might be worth it anyway; it really is an excellent C text. No C99 yet, he's working on a revision.

    --
    My blog: http://www.seebs.net/log/ --- My iPhone/iPad app: http://www.seebs.net/seebsfrac/