102
votes
What are good examples that actually motivate the study of recursion?
I find a very easy to understand example for recursion is the folder structure on a computer.
Look through all folders (within a certain location) and... list all .doc files, for example.
First, you ...
98
votes
Accepted
How to explain the concept of a variable to a 9-year old?
Buffy's lovely answer shows well how two variables can refer to the same thing, but since we are in early cognitive development and working with Scratch, in which you can't pass parameters, and can't ...
47
votes
Real life examples of 0-indexing
You can get at this concept very intuitively in strings before you ever get to arrays. Take a string like "hello world" and ask them a subtle-sounding point: does the string begin here: ...
44
votes
Real life examples of 0-indexing
Ages in the United States (it's not the same around the world).
For the first year of life, children are 0 years old. Only after completion of a year is the age changed to 1. By this logic, a child ...
44
votes
Accepted
Interesting Programming Exercises to Teach Inheritance?
I'm not as familiar with Python as I am with other languages, but I'm sure your students have played Minecraft.
If you haven't, I suggest taking a few minutes to find some introductory "Lets Play" ...
42
votes
How to explain the concept of a variable to a 9-year old?
My usual explanation is related to names; specifically names of people. People have names. The names are not the people, but can be used to refer to the people.
Some people don't have any names at ...
37
votes
Real life examples of 0-indexing
An analogy that will work well in Europe, but not in North America:
Image licensed under the CC BY-SA 3.0 by Bidgee of Wikimedia Commons.
Floors (in European countries) are typically numbered with 0 ...
37
votes
Accepted
Demonstrating the possible dangers of SQL injection
The best way to show your students that their work is vulnerable to SQL injection is to demonstrate it. I'd suggest that you challenge the students to "hack" each others projects using SQL injection. ...
33
votes
How to teach Stack Overflow more efficiently?
I don't think the core issue is that some students are bad at using Stack Overflow -- I view that more as a symptom of a deeper root problem. When somebody doesn't seem to be able to productively ask ...
26
votes
What are good examples that actually motivate the study of recursion?
One good example is to make permutations of all of the letters in a word of arbitrary length. It's quite tricky to do iteratively, since you essentially have to recreate the program stack to get it ...
26
votes
How to explain the concept of a variable to a 9-year old?
What about
You have alot of values that you need to remember, so you put a label on each one (a little piece of paper to remind you what this value means) so you can find the value easily when you ...
24
votes
Real life examples of 0-indexing
The clock (24 hours system)
If we look at the clock, we have two examples of counting hours. The 24 hour system starts at 0. The 12 hour system is interesting, neither starting at 0 or 1.
The 12-hour ...
24
votes
How do you teach Big O to high schoolers with varying degrees of math exposure?
One good overall educational strategy is to teach the same thing to students repeatedly, using a Spiral approach, in which each turn of the spiral teaches at a deeper level. Don't expect the students ...
22
votes
How to teach the value of the command line in high school?
I can't speak to cloud9 but I've always taught on Linux and am a CLI wonk.
One thing I do is differentiate between user friendly and learner friendly. GUI interfaces are learner friendly - they're ...
21
votes
What are good examples that actually motivate the study of recursion?
Writing recursive code to output the Snowflake Curve (Koch snowflake) was something that definitely pushed my buttons early on.
It's formed as follows:
The Koch snowflake can be constructed by ...
20
votes
Accepted
How to respond when students ask "is recursion good practice"?
Quite honestly, I would be upfront with them about the debate. Send them to a couple other SE threads:
Efficiency: recursion vs loop
“Necessary” Uses of Recursion in Imperative Languages
Are ...
20
votes
What are good examples that actually motivate the study of recursion?
Other than the obvious merge sort, I really like the minimax algorithm, especially when applied to creating a computer player of a simple game.
Start with something simple like tic-tac-toe. When it's ...
19
votes
How to teach the value of the command line in high school?
One way to show them the value of the command line would be to juxtapose doing a task with a GUI and with the command line. You could do something like the following:
Create a directory with mixed ...
19
votes
Non-native English speakers struggle to come up with decent variable names and function names
The point of good variable/function/class naming is to express problem semantics to readers, including the programmers. If your readers are primarily French speakers, use good French naming for ...
18
votes
Demonstrating the possible dangers of SQL injection
A couple suggestions -
The classic xkcd comic about Bobby Tables:
Shown, complete with the explain xkcd article can provide a nice, humorous introduction that will get them to start paying to ...
17
votes
Explaining why styling should not be done directly in HTML
I like the idea of producing a few style sheets, and having the pupils apply them to their HTML. They can then see the power of having separate style sheets.
Start with a style sheet that you made. ...
16
votes
Interesting Programming Exercises to Teach Inheritance?
Too many examples that you find are (IMO) fatally flawed. The Animal->Dog is especially flawed, though widely used. The problem is that these sorts of examples almost require that the superclass has a ...
15
votes
How to respond when students ask "is recursion good practice"?
When I teach recursion, even if I am not at a point in the curriculum where it is possible to introduce trees in coding problems, I always at least provide a high level discussion of trees, and the ...
15
votes
Accepted
How to teach the value of the command line in high school?
You can't teach the value of the command line. You can, however, sell it.
Students have at least one of two primary goals in any class:
Get good grades (pass the class)
Learn something they like
...
15
votes
How to explain the concept of a variable to a 9-year old?
The variable that children are most familiar with is score: whether in computer games, sports or board games, a child will almost certainly understand that a score is a value that is clearly not ...
13
votes
What are good examples that actually motivate the study of recursion?
I'm going to focus on student's understanding recursion at a fairly deep level, rather than coding.
First, to really understand recursion you need a sense of its parts. There is the base case, of ...
12
votes
How to teach the value of the command line in high school?
Not a demonstration, but maybe a nice thought to tell your students. I read a nice analogy a few months ago, linked from a question somewhere on stackexchange:
Using a computer only with a GUI is ...
12
votes
Accepted
How to stress the importance of testing code?
Introduce test-driven development.
TDD and agile methods of development are very popular at the minute, and for good reason — you know, ahead of time, exactly what each part of the program must ...
11
votes
How can I convey the idea of a programming language vs. a markup language?
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 ...
11
votes
Lesson Idea: Arrays, Pointers, and Syntactic Sugar
You overestimate the complexity of 0-based indexing a lot. There is nothing complex in 0-based indexing.
On the other side, the topic of the pointers is relatively complex. I don't think it has any ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
lesson-ideas × 114secondary-education × 12
algorithms × 11
introductory-lesson × 10
teaching-analogy × 9
curriculum-design × 8
resource-request × 8
student-motivation × 8
best-practice × 6
object-oriented-paradigm × 6
programming × 5
python × 5
labs × 4
web-development × 4
c × 4
cs-theory × 4
undergraduate × 3
project × 3
ap-computer-science-a × 3
exercises × 3
data-structure × 3
functional-programming × 3
computational-thinking × 3
arrays × 3
abstraction × 3