36

Use money. Tell your students to image a country has bills that are in denominations of powers of 2: 1, 2, 4, 8, 16.... Now tell them this: For a given number, count out that money with as few bills as possible. You use a "greedy algorithm:" Use the largest bill possible. Repeat this until you have counted out the amount. Questions to ask: Did you ...


31

I think this is a problem where the answer is partly in the prevention. I've observed many classes where printing is the method used to access the results of calculations for several weeks, both within functions and within main(). Then, return values of functions are suddenly introduced, but, they only serve to pass the result to main to be printed once ...


21

When I was teaching and mentoring first-time students, what got them really excited for the first time was seeing their name in lights. Write a program that allows a student to enter their name, then print it on the screen 10 times (or 10,000). It introduces the concept of variables and variable types It shows how computers interact with the outside word by ...


18

I think that this problem is pretty widespread, actually. I believe that it comes from a misunderstanding of the difference between what the program/computer can know/do and what the person operating it can know/do. I think the problem is worse for interactive systems where the printf sends its output to the screen in front of the person running the program. ...


14

Just to calibrate expectations: at the lower end of that age range, the kids will have only just started learning about the place-value system in decimal. I wouldn't try to leverage knowledge of things like "carrying" in decimal over to binary. My own kids are at boundaries of your age range, and in first and second grade they use things like "tens frames" ...


12

This is such a consistent trap that I ultimately created a worksheet to deal with it. At this point in my course, I have recently covered binary and hexadecimal, so I also use this worksheet as an opportunity to gently review those concepts. My worksheet may not be as physically active as some of the lessons that have already been posted, but it is highly ...


11

I also have this problem frequently. I use the example of Microsoft Word, and I would say something like this: "Word allows you to give a document the appearance that you'd like. You can bold, you can center, you can change font sizes. Word is creating a markup (in this case, it is generating a type of markup called XML). "Markups" mark up text, just ...


11

You shouldn't "test" somebody to check whether they're interested in something. You should give them some stuff you think they might enjoy, and you let them decide for themselves. There are a ton of programming languages designed for novices, including: Processing. This is my personal favorite. Shameless self-promotion: I've written a series of tutorials ...


11

At that age, I would skip binary notation entirely and focus on combinatorics problems (simple ones) whose answers are most clearly understood as combinations of powers of two. Any combinatorics (counting) problem where the full set of answers can be systematically written down by hand, and then counted, is the most appropriate. Or if it can be physically ...


10

I did a (rather unscientific) study of a few popular tutorials for Python to see what they did after "Hello, world": Learn Python the Hard Way introduces expressions (25 + 30, 5 + 7 > 3 + 1), and implicitly hints at types (although never mentions them by name in the chapter after "Hello, world"). Codecademy introduces variables (assignment), then types, ...


10

Check out the Python books written by Al Sweigart. His homepage Invent with Python includes some great, free resources that are geared to the age range of your students. In particular he focuses on creating games which is, in my experience, an effective hook. Two books to use to inform your teaching are the following (in order): Invent Your Own Computer ...


10

Some of these words are entirely necessary, some (such as tokenize) you might want to avoid early on. However, I would suggest this as a guiding principle: use vocabulary as is necessary to get at the core goals you hold for your students, but do not emphasize vocabulary for its own sake. A great visualization or metaphor at the very start (after all, ...


10

I was going to start by asking what was wrong with $11_2$ and $11_{10}$, and then I noticed the ages you were referring to. Six year olds! First, a bit of frame-challenging advice: I'm not sure that counting in binary is what I would focus on at that age at all. You might have better luck with finite state machines, which are great CS concepts that you ...


9

How did you begin to teach Java to your students? I bet you didn't start by showing them the Backus-Naur form that the Java parser follows. Instead, you probably introduced a simple "Hello, world" program, and slowly built on that with assignments and projects for the students to work on. I'm sure you can see the parallel here—teaching XML as a prerequisite ...


8

After "Hello World" it becomes "Hello \$name" where \$name is provided by user. After basic I/O and "it compiles and runs", then it is time for loops and logic. I typically like a variation on fizzbuzz: Print the numbers 1 through 100, if the number is evenly divisible by 3 print "fizz" next to the number, if evenly divisible by 5 print "buzz" next to ...


8

I introduce C macros as a convenient way of using a single source file that can be used both when debugging code in development and for final delivery, without having to edit and and edit out test/debug code. I am doing it, in particular, in the context of using the compiler development tools flex and bison, but it would be equally valid when using just C. ...


8

I started with Khan Academy. Who knows how I stumbled across it - I think one of my teachers back in elementary school pointed it out to me. And then I found the coding course. I started, enjoying drawing the shapes on the screen with some characters. I was talking to the computer! I wasn't very consistent about it though, and my interest soon petered off. ...


8

Whenever I run into students who are baffled by the return concept (and in your case, them substituting it with printf), I do something like this. I use role-play. I become one function (lets say the main function) and the student is another function (lets say some function add that adds two numbers and returns the values). Here is how the role play ...


8

We made bracelets in APCS Principles (9th - 12th grade). I bought a bunch of blue and white (school colors) beads. Blue was on, white was off. They then made bracelets of their names or initials using 5 bits. A was 1 (w-w-w-w-b), B was 2 (w-w-w-b-w), etc. Kids seemed to enjoy it, and I caught a few wearing their bracelets walking around the halls days ...


8

Going with real-world things which they should be familiar with are best, even if it is completely outside of education. As you have applied the tag for adult education, I'm going to presume it is outside of normal university/college courses. A bit of creativity and looking around can develop many an idea as long as you get outside the box. The cafeteria ...


7

Spreadsheets are probably the most popular functional programming language, and is is some what visual. I have taught it for years 7 to 9, but not part of a qualification based course. Things to be aware of: It is a functional language, as long as you avoid VBA / macros etc. You can do functions, though I am not sure about named functions. I like to put ...


7

Have you considered not teaching them about printf at all? 99% of the use of printf is as a poor-man's debugger. Teach them how to properly use a debugger to step through their code, and inspect their variables, rather than defensively printing out everything all the time, and doing post-mortems on log output.


7

This sort of thing is perfectly valid and valuable, provided that students already understand the underlying structure. So if they understand your first loop without continue (but with the print in place) the adding continue lets them see the effect dramatically. The same is true of your second example. If they understand strings as arrays or lists (or ... ...


7

The way I got my kids interested in binary representation was to discuss up to what number they could count on one hand. Learning they could count up to 31 and then understanding why, made the trick. You can then impress them yet again when you show them that with ten fingers then can count to 1023.


6

I would avoid starting with something this abstract if the aren't used to it. Doing so might, in my experience, turn away students, especially since the beginning is usually the easiest. If the beginning is hard, they might not understand it. I would start by explaining the basics like <html>, <body>, <head>, and also images, links, etc. ...


6

I agree with Peter. It needs to be fun, and games really help. It doesn't take much to exercise basic programming concepts such as variables, loops, selection, input, and output. I would start with simple games like Tic-Tac-Toe and Number Guessing Game. Implementing a simple AI would be fun. I've found that in-class programming contests work well too. For ...


6

Beware. "The One True Lecture" is an oxymoron. I have a horror story about trying to create such a lecture to teach elementary statistics. It was perfect in every way and explains sampling without ambiguity. It. Was. Perfect - for me. A generous evaluation of it would suggest I reached maybe 15% of my students. The problem was (and often is) "Your students ...


6

I think that to understand the SELECT queries, the Who is Who? / Guess Who? game could serve as a nice metaphor. The idea of the game is: you have a group of pictures of persons with different facial features. One gamer selects one of them and the other gamer has to make questions to try to eliminate the ones that are not relevant and try to guess which one ...


6

Certainly mention the vocabulary, but I wouldn't make it mandatory to learn the words or use them correctly in class. What matters is that the students understand the concepts that go with the words, not that the know the dictionary definitions. Introduce all the vocabulary when it comes up in class, but don't be a stickler, especially early on. Let the ...


6

The big disadvantage seems to be that you're re-enforcing their (or maybe your own) preconceptions about barriers to entry, and taking them further from the 'normal' programming environment. Yes, you can twist a spreadsheet to demonstrate some topics, but the biggest misconception you will teach by starting like this is 'everything executes in parallel'. ...


Only top voted, non community-wiki answers of a minimum length are eligible