Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Education Programming

Resources for Teaching C to High School Students? 166

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?"
This discussion has been archived. No new comments can be posted.

Resources for Teaching C to High School Students?

Comments Filter:
  • by simm1701 ( 835424 ) on Friday December 15, 2006 @06:47AM (#17252642)
    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.
    • 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.
      • 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..
        • 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, an
    • 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 thos
    • by Bones3D_mac ( 324952 ) on Friday December 15, 2006 @07:09AM (#17252754)
      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.
      • by mctk ( 840035 )
        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-motiva
        • 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 o
          • Re: (Score:3, Interesting)

            by edwdig ( 47888 )
            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
    • 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 Analys
      • 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

        • 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 g
      • "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 /.
    • 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.
    • give them an understanding of where the libraries they are suing will come from.

      SCO stop teaching our kids for pity sakes!!
    • 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.
    • 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.
    • 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
      • (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
        • 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 o
  • by Channard ( 693317 ) on Friday December 15, 2006 @06:48AM (#17252644) Journal
    ... 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!
    • 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)
  • by kestasjk ( 933987 ) * on Friday December 15, 2006 @06:49AM (#17252656) Homepage
    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.
    • 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 a
      • by AlXtreme ( 223728 ) on Friday December 15, 2006 @07:24AM (#17252844) Homepage Journal
        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.

        • 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 g
          • 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.

        • by bigsmoke ( 701591 ) <bigsmoke@gmail.com> on Friday December 15, 2006 @08:37AM (#17253290) Homepage Journal

          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 [greenteapress.com]

        • 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. Py
        • 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
      • by iamdrscience ( 541136 ) on Friday December 15, 2006 @07:35AM (#17252906) Homepage
        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.
        • 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

          • by rk ( 6314 ) *

            "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 [wikibooks.org] with Python's [wikibooks.org].

      • 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...
      • 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?
        • 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
          • Re: (Score:3, 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'

          • Re: (Score:2, Insightful)

            by kpharmer ( 452893 )
            > 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 t
      • With today's freely available (OSS) Free Pascal compiler [freepascal.org] 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
    • by RobinH ( 124750 )
      Exactly, start them on assembly like the rest of us, and let them graduate to C once they've felt the pain. :)
      • It is more simple and straight forward than a higher level language. I taught myself using a free book online, Art of Assembly [computer-books.us], 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 th
    • 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 programmi
    • by arcade ( 16638 )
      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
      • 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 th

    • 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.
  • by ForestGrump ( 644805 ) on Friday December 15, 2006 @07:04AM (#17252714) Homepage Journal
    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.
  • by A beautiful mind ( 821714 ) on Friday December 15, 2006 @07:05AM (#17252726)
    For example, did you know that 99.99% of high school students can't read Perl? [bbspot.com]. Shameful, shameful.

    [foot icon here]
  • 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 co
  • 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 prob
    • Re: (Score:3, Insightful)

      by Timesprout ( 579035 )
      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
  • 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 functi
  • 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 [greenteapress.com]". It'
  • 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 [amazon.com], 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

  • 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 th
  • by Aladrin ( 926209 ) on Friday December 15, 2006 @07:42AM (#17252954)
    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.com]

    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.
    • by afidel ( 530433 )
      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.
  • Use Koenig and Moo's Accelerated C++ [acceleratedcpp.com] 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.
  • in high school... (Score:4, Interesting)

    by defy god ( 822637 ) on Friday December 15, 2006 @07:48AM (#17252994)

    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 [amazon.com]. 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 [amazon.com]. 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.

    • by jbarr ( 2233 )
      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 1
  • Berkeley Machine Structures first 8 lessons or so provide a quick and dirty intro to C.
    http://webcast.berkeley.edu/courses/archive.php?s e riesid=1906978347 [berkeley.edu]
    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.
  • 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

  • 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. [amazon.com] There's also the free online textbook, How to Think Like a Computer Scientist [ibiblio.org]. 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 wha

  • The following lists of freely down loadable books contain a lot of useful material:
    • all C [computer-books.us]

    The Wikipedia article [wikipedia.org] on C lists some tutorial material.

  • 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 f

  • by Dareth ( 47614 ) on Friday December 15, 2006 @09:48AM (#17253966)
    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 [mit.edu] and the Berkeley Webcast [berkeley.edu].

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

  • by miyako ( 632510 ) <miyako AT gmail DOT com> on Friday December 15, 2006 @09:58AM (#17254144) Homepage Journal
    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.
  • 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
  • by ciggieposeur ( 715798 ) on Friday December 15, 2006 @10:08AM (#17254276)
    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.
    • 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.
  • 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.

  • 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), a
  • 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.

  • by Stradivarius ( 7490 ) on Friday December 15, 2006 @11:34AM (#17255750)
    The industry group Association for Computing Machinery has a model curriculum [acm.org] for integrating computer science into K-12 education. You might find some helpful ideas in there.

  • 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
    • by mctk ( 840035 )
      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 programmi
      • 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 yo
  • 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* co
  • 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 tha

  • 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.
  • There are only two books: The C Programming Language [wikipedia.org] by Kernighan and Ritchie; and Expert C Programming [amazon.com] 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
  • by seebs ( 15766 )
    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.

I tell them to turn to the study of mathematics, for it is only there that they might escape the lusts of the flesh. -- Thomas Mann, "The Magic Mountain"

Working...