Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Resources for Teaching C to High School Students?

Cliff posted more than 7 years ago | from the best-time-to-learn dept.

Education 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?"

Sorry! There are no comments related to the filter you selected.

Don't teach the language (4, Insightful)

simm1701 (835424) | more than 7 years ago | (#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.

Re:Don't teach the language (1)

Rakshasa Taisab (244699) | more than 7 years ago | (#17252692)

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.

Re:Don't teach the language (1)

somersault (912633) | more than 7 years ago | (#17255260)

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

Re:Don't teach the language (1)

somersault (912633) | more than 7 years ago | (#17255306)

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

Brace style (1)

simm1701 (835424) | more than 7 years ago | (#17252716)

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.

Re:Don't teach the language (3, Informative)

Bones3D_mac (324952) | more than 7 years ago | (#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.

Text book (1)

simm1701 (835424) | more than 7 years ago | (#17252770)

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

Re:Don't teach the language (1)

Mr2cents (323101) | more than 7 years ago | (#17252926)

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.

Re:Don't teach the language (0)

Anonymous Coward | more than 7 years ago | (#17253208)

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".

Re:Don't teach the language (1)

Mr2cents (323101) | more than 7 years ago | (#17253820)

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.

Re:Don't teach the language (1)

MindStalker (22827) | more than 7 years ago | (#17253716)

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

SCO stop teaching our kids for pity sakes!!

Re:Don't teach the language (1)

simm1701 (835424) | more than 7 years ago | (#17254294)

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


Re:Don't teach the language (0)

Anonymous Coward | more than 7 years ago | (#17254762)

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.

Watch out, though... (2, Insightful)

Channard (693317) | more than 7 years ago | (#17252644)

... 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!

Re:Watch out, though... (1)

Loconut1389 (455297) | more than 7 years ago | (#17252738)

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)

Re:Watch out, though... (0)

Anonymous Coward | more than 7 years ago | (#17252870)

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

Re:Watch out, though... (1)

FireFlie (850716) | more than 7 years ago | (#17253126)

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.

Re:Watch out, though... (2, Informative)

StupidMBA (1039062) | more than 7 years ago | (#17253178)

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

I know I'll get modded down for this: (5, Interesting)

kestasjk (933987) | more than 7 years ago | (#17252656)

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.

Re:I know I'll get modded down for this: (1)

simm1701 (835424) | more than 7 years ago | (#17252684)

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.

Re:I know I'll get modded down for this: (3, Informative)

AlXtreme (223728) | more than 7 years ago | (#17252844)

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.

Re:I know I'll get modded down for this: (1)

simm1701 (835424) | more than 7 years ago | (#17252918)

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.

Re:I know I'll get modded down for this: (1)

melikamp (631205) | more than 7 years ago | (#17253064)

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.

A free book to learn CS using Python (5, Informative)

bigsmoke (701591) | more than 7 years ago | (#17253290)

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 []

Re:A free book to learn CS using Python (1)

AlXtreme (223728) | more than 7 years ago | (#17254426)

Great tip, thanks!

Re:I know I'll get modded down for this: (-1, Flamebait)

Anonymous Coward | more than 7 years ago | (#17254756)

You are kidding or dangerous...

You are blinded with Python...

It's not so good...doesn't add anything, it's just another language that desperately wants to be different.

It's not a teaching tool...

If you want to teach, use the one language designed to teach with: Pascal...

Re:I know I'll get modded down for this: (0)

Anonymous Coward | more than 7 years ago | (#17254846)

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

Re:I know I'll get modded down for this: (3, Insightful)

iamdrscience (541136) | more than 7 years ago | (#17252906)

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.

Here we go again (-1)

Anonymous Coward | more than 7 years ago | (#17253002)

Bring out the python zealots...

You guys are like a cult dude, when does the coolaid come out????

Re:I know I'll get modded down for this: (1)

melikamp (631205) | more than 7 years ago | (#17253154)

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.

Re:I know I'll get modded down for this: (0)

Anonymous Coward | more than 7 years ago | (#17253842)

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

j@turing ~/python $ cat >
print 'Hello, World!'
j@turing ~/python $ python
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?

Re:I know I'll get modded down for this: (1)

melikamp (631205) | more than 7 years ago | (#17254048)

My bad, I meant procedural, not functional.

Re:I know I'll get modded down for this: (1)

j35ter (895427) | more than 7 years ago | (#17253902)

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.

Re:I know I'll get modded down for this: (1)

rk (6314) | more than 7 years ago | (#17254770)

"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 [] .

Pascal... (1)

Anonymous MadCoe (613739) | more than 7 years ago | (#17252940)

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

Re:I know I'll get modded down for this: (1)

melikamp (631205) | more than 7 years ago | (#17253012)

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?

Re:I know I'll get modded down for this: (1)

simm1701 (835424) | more than 7 years ago | (#17253188)

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.

Re:I know I'll get modded down for this: (1)

tootlemonde (579170) | more than 7 years ago | (#17253470)

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.

Re:I know I'll get modded down for this: (1)

simm1701 (835424) | more than 7 years ago | (#17254382)

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.

Free Pascal (1)

truefluke (91957) | more than 7 years ago | (#17254220)

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.

Re:I know I'll get modded down for this: (1)

Psychotria (953670) | more than 7 years ago | (#17252868)

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?

Re:I know I'll get modded down for this: (1)

RobinH (124750) | more than 7 years ago | (#17252974)

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

Assembler is beautiful (1)

Dareth (47614) | more than 7 years ago | (#17253830)

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.

think of the children (1)

Zoxed (676559) | more than 7 years ago | (#17253070)

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

C IS a learning tool (2, Interesting)

Iwanowitch (993961) | more than 7 years ago | (#17253396)

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.

You need more... (3, Funny)

ForestGrump (644805) | more than 7 years ago | (#17252714)

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.


Re:You need more... (0)

Anonymous Coward | more than 7 years ago | (#17252800)

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.

Re:You need more... (0)

Anonymous Coward | more than 7 years ago | (#17253074)

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.

I share your sentiment (2, Funny)

A beautiful mind (821714) | more than 7 years ago | (#17252726)

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

[foot icon here]

Mod parent funny!! (0)

Anonymous Coward | more than 7 years ago | (#17252802)

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

Re:I share your sentiment (2, Insightful)

iamdrscience (541136) | more than 7 years ago | (#17252934)

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

My experience (1)

the_brobdingnagian (917699) | more than 7 years ago | (#17252742)

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.

Memory (1)

BAILOPAN (694545) | more than 7 years ago | (#17252746)

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.

Re:Memory (2, Insightful)

Timesprout (579035) | more than 7 years ago | (#17252894)

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.

Educate the Youth (1)

WarJolt (990309) | more than 7 years ago | (#17252796)

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. [] 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?

Re:Educate the Youth (1)

Schraegstrichpunkt (931443) | more than 7 years ago | (#17252892)

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

Re:Educate the Youth (1)

WarJolt (990309) | more than 7 years ago | (#17253202)

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. -John-Perry/dp/0534951406/sr=8-1/qid=1166185131/re f=sr_1_1/103-8230721-4280618?ie=UTF8&s=books []

Re:Educate the Youth (1)

Schraegstrichpunkt (931443) | more than 7 years ago | (#17253534)

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

A Book on C (1)

Psychotria (953670) | more than 7 years ago | (#17252826)

"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.

Practical C (1)

iamdrscience (541136) | more than 7 years ago | (#17252850)

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.

K&R2 (1)

Schraegstrichpunkt (931443) | more than 7 years ago | (#17252876)

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.

Re:K&R2 (1)

Schraegstrichpunkt (931443) | more than 7 years ago | (#17252998)

Regarding game programming, I should also mention Allegro [] , and [] .

use K&R's book (2nd ed) (1)

KeyserDK (301544) | more than 7 years ago | (#17252928)

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.

Re:use K&R's book (2nd ed) (0)

Anonymous Coward | more than 7 years ago | (#17253940)

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?

Teaching books, not reference. (2, Informative)

Aladrin (926209) | more than 7 years ago | (#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. []

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.

Re:Teaching books, not reference. (1)

FireFlie (850716) | more than 7 years ago | (#17253216)

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.

My suggestion (1)

Curien (267780) | more than 7 years ago | (#17252956)

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.

in high school... (4, Interesting)

defy god (822637) | more than 7 years ago | (#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 [] . 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.

One word... (0)

Anonymous Coward | more than 7 years ago | (#17253010)


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.

Nothing, I think (1)

WgT2 (591074) | more than 7 years ago | (#17253022)

Nothing! They get C's on their own!

Am I in the wrong forum?

Ontogeny recapitulates phylogeny (0)

Anonymous Coward | more than 7 years ago | (#17253024)

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.

Webcast (1)

mondoterrifico (317567) | more than 7 years ago | (#17253052)

Berkeley Machine Structures first 8 lessons or so provide a quick and dirty intro to C. 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.

Re:Webcast (0)

Anonymous Coward | more than 7 years ago | (#17253558)

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.

Re:Webcast (1)

mondoterrifico (317567) | more than 7 years ago | (#17254578) /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.

Build foundations and generate interest. (1)

smartr (1035324) | more than 7 years ago | (#17253056)

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.

Newsgroups (1)

Anonymous Brave Guy (457657) | more than 7 years ago | (#17253114)

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.

What do you want to accomplish? (1)

v1z (126905) | more than 7 years ago | (#17253120)

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 [] and [] .

Java comes a close second, but even using a tool such as [] or [] , 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 [] and/or [] . 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).

Re:What do you want to accomplish? (1)

Mr. Shiny And New (525071) | more than 7 years ago | (#17254196)

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.

Flamebait? (1)

tfinniga (555989) | more than 7 years ago | (#17253210)

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.

Re:Flamebait? (0)

Anonymous Coward | more than 7 years ago | (#17253550)

+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).

Re:Flamebait? (1)

tfinniga (555989) | more than 7 years ago | (#17254148)

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.

A short list of resources (1)

derek_farn (689539) | more than 7 years ago | (#17253336)

The following lists of freely down loadable books contain a lot of useful material:

  • all C []
The Wikipedia article [] on C lists some tutorial material.

Very friendly book for people new to *programming* (0)

Anonymous Coward | more than 7 years ago | (#17253508)

"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.

Make it Fun: Get everyone a GP2X. (1)

torpor (458) | more than 7 years ago | (#17253672)

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

My First CS Class (1)

ggKimmieGal (982958) | more than 7 years ago | (#17253792)

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.

I'd suggest OO instead (1)

krenn (155183) | more than 7 years ago | (#17253930)

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 ( [] ) with cygwin ( [] ) 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 ( [] ).

As a book I would suggest one I have enjoyed using in its online form, Thinking in C++ by Bruce Eckel ( 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.

The language doesn't matter (1)

TVmisGuided (151197) | more than 7 years ago | (#17253956)

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.

Educate the Educator - Resources (2, Informative)

Dareth (47614) | more than 7 years ago | (#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 [] and the Berkeley Webcast [] .

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

Go for the K&R (0)

Anonymous Coward | more than 7 years ago | (#17254084)

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.

Example Exercise (0)

Anonymous Coward | more than 7 years ago | (#17254136)

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?

Consider Their Maths Background (2, Informative)

miyako (632510) | more than 7 years ago | (#17254144)

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.

From a college grad who spent 4 years doing C ... (2, Insightful)

LSU_ADT_Geek (580524) | more than 7 years ago | (#17254178)

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) ( 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) ( 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!

C is an excellent choice (2, Informative)

ciggieposeur (715798) | more than 7 years ago | (#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.

K & R (1st Ed) (1)

gluteus (307087) | more than 7 years ago | (#17254724)

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

Turbo Pascal (1)

SocialEngineer (673690) | more than 7 years ago | (#17255006)

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.

Whoa. Slow down. Don't teach C to first timers. (1)

Purity Of Essence (1007601) | more than 7 years ago | (#17255152)

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.

Language not important (1)

Tsu-na-mi (88576) | more than 7 years ago | (#17255170)

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:

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.

so I've been in this situation (1)

Akatosh (80189) | more than 7 years ago | (#17255206)

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.

Karel the robot (1)

hoggoth (414195) | more than 7 years ago | (#17255516)

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.

Check out the ACM K-12 model curriculum (2, Informative)

Stradivarius (7490) | more than 7 years ago | (#17255750)

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.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?