# Tag Info

Accepted

### Explaining access levels and visibility in OOP

Here's an analogy that I've used for several years, and that students seem to understand. It doesn't focus on the rules, but why we have public and private and protected. "Most of you know that I ...

### Teaching students that printf() is not the same as return

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 ...
• 1,985

### Analogy for teaching recursion

The Tower of Hanoi was one of the first ways that I encountered recursion. "The objective of the puzzle is to move the entire stack to another rod, obeying the following simple rules: Only one disk ...
• 1,266
Accepted

### How to respond to the two-handed approach to swapping

Don't overcomplicate things. Your first instinct, that the computer only has one hand, was the correct one. This is a regular problem that new teachers have, and it sometimes takes a few years of ...
• 33.7k
Accepted

### What are some good examples of using a stack data structure?

I once had to implement a limited undo function (undo changes to the current field, or addition/deletion of records). The lists of undo deltas (one for field changes and one for records) were stored ...
• 356

### The Tao of TeaChing (Making Mistakes in Front of the Class)

If I catch it quickly and can easily explain the error, I use it as an example of failing up. "Ooops, look at me, here's my mistake, here's how I can learn from it." If students catch it, and I'm not ...
• 481

### How to respond to the two-handed approach to swapping

Re-evaluate what you think is "right", because you aren't but isn't right in computer science This is simply incorrect. Your student can create two variables called ...
• 1,072

### Analogy for teaching recursion

Can't claim it's my own idea but I can embellish it a little... Imagine you are entering a cinema. You sit down in a row but realise you had to sit in row 20. Being a lazy computer scientist in an ...

### Teaching students that printf() is not the same as return

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 ...
• 36.4k

### What are some good examples of using a stack data structure?

A stack of trays in a cafeteria. I also like the pole of rings analogy. With the trays, you can pop (take a tray) and push (return it when you're done). You can see what the top tray (first item) is (...
• 768

### How to respond to the two-handed approach to swapping

Your problem is that you tried to let your student "program" without establishing a language. Thus they were free to write their own "language" in which you can do two things at ...
• 1,493

### Analogy for teaching recursion

The image that I kept in my head when I was learning recursion was from Dr. Seuss:

### What are some good examples of using a stack data structure?

A rather interesting analogy is that of a firearms magazine. if we look at this picture: It is easy to see that bullets can be inserted from the top, and only the topmost bullet is accessible. Such ...
• 6,312
Accepted

### Analogy for teaching recursion

I like to use something that a student can connect with and something that they have to deal with regularly. You could choose any recursive everyday activity, but I like to choose revising an essay. ...
• 4,795

### What is a good analogy for the Object Oriented paradigm?

I've got to jump in here and talk about my experience having to help a former boss understand why the project he wanted to do wasn't possible in the time available. It came down to incompatible data ...

### What are some good examples of using a stack data structure?

The back button on a web browser is an excellent example of a stack implementation that is easily understood even by non-experts and easily demonstrated in a class. You can illustrate the stack in ...

### What are some good examples of using a stack data structure?

Check whether a string of parentheses is balanced or not. For example, return True for these input strings: (()()) ([]{{}}[]) ...
• 241

### The Tao of TeaChing (Making Mistakes in Front of the Class)

Mistakes are fine. We are human, we make mistakes. In fact, one of the worst things you can do in teaching is to never make a mistake and to always say exactly the right thing. This is pretty much ...
• 36.4k

### Explaining access levels and visibility in OOP

What my teachers used was the following example, which is pretty simple and most people understood. Your father orders a pizza. The delivery guy arrives and expects payment. The ...

### A real world example for the divide and conquer method

Back around 1985, Susan Merritt created an Inverted Taxonomy of Sorting Algorithms. The idea is that to sort an array you have two phases, the split phase and the join phase. She divided the various ...
• 36.4k

### Explaining access levels and visibility in OOP

Ooh, this is one of my favorite lessons! I don't introduce package private and protected in the same lesson as private and public, because there are 3 principles that I want them to absorb that ...
• 33.7k

### What would be a good analogy for IP addresses and ports?

I used seats in the room. The classroom has an address. So, if someone wanted to come and talk to one of the students they would come down the hall and into my room. But, that only gets them to ...
• 3,009

### Teaching students that printf() is not the same as return

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 ...
• 33.7k
Accepted

### Good, Motivating Examples for Algorithmic Complexity

I attack this problem with three "visits" over the course of two years with my students At our first brush with Complexity, I don't spend a ton of time motivating the study of it. I introduce the ...
• 33.7k

### What are some good examples of using a stack data structure?

I like the pez dispenser. Also the stack of papers (where the actual human interaction is never to take the top item but rather to take the second from the top. At some point you have to talk about ...
• 1,572
Accepted

### The Tao of TeaChing (Making Mistakes in Front of the Class)

The teaching philosophy I came to as a young teacher (i.e. in my first year) was that I would ground myself in two qualities: passion and humility. (I've since added gratitude as an important third, ...
• 9,102

### Teaching students that printf() is not the same as return

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 ...
• 1,884

### What are some non-CS concepts that can be defined using BNF notation?

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 ...
• 5,445