Fog Creek Software
g
Discussion Board




teaching pointers with excel?

Does anyone know of any tools for teaching pointers based on excel (or any other spreadsheet?). I've taught a lot of people to use spreadsheets over the years, and everyone readily understands the difference between a cell address and the value stored in it, and again that the value may actually be the result of a formula in the cell. You can even use the INDIRECT function for an extra layer of, er, indirection. If anyone does use excel for this purpose I'd appreciate some pointers (ha ha) rather than re-invent the wheel.

gh
Thursday, April 29, 2004

I think this is a fabolous idea. Being a teacher, I was faced with explaining pointers several times and I'd consider using your approach the next time I'll have to explain pointers.

Ignore my ignorance
Thursday, April 29, 2004

that's a good idea ... esp. the Offset() function which is as close to pointer arithmatic as you can get!

Joel Spolsky
Fog Creek Software
Thursday, April 29, 2004

I agree that it's a good idea for teaching general principles of pointers, but I've found that cons-pair diagrams work best for explaining data structures that use pointers (linked lists, binary trees, etc).

Kalani
Thursday, April 29, 2004

Yes, but one of the benefits of using excel is that including diagrams as part of the learning model is incredibly easy!

gh
Thursday, April 29, 2004

I've only ever taught pointers using the analogy of a card catalog - that it's easier to sort the cards than the books, and each cards points to a specific book on a specific shelf.

Seems to work for me. :)

Philo

Philo
Thursday, April 29, 2004

Philo,

I like that description, but what are you going to do with the youngsters?  I can remember using a card catalog, but by the time I was in 7th grade, it sat unused in the corner.  Everyone did PC lookups.

I suspect that it's kind of like asking a kid what an LP is. :)

Dignified
Thursday, April 29, 2004

LP= Long Pointer ?


Couldn't resist.

Mr. Analogy
Thursday, April 29, 2004

So you explain a card catalog - it's not that big a deal (tho sad that they're gone). Just the idea that you have a bookshelf full of books, so you write a number on the book and on the card, then put the books' titles on the cards.

Sort the cards instead of sorting the books, then use the cards to find the books.

Philo

Philo
Thursday, April 29, 2004

The only slight problem with the book analogy is that each book doesn't occupy a certain "slot" on the bookshelf.  What's nice about the Excel analogy is that the concept of a cell is very close to the concept of a location in memory.

Of course, if it works for you...stick with it!

*grin*

Dave

Dave
Thursday, April 29, 2004

"The only slight problem with the book analogy is that each book doesn't occupy a certain "slot" on the bookshelf"

It does if you stick to moving the cards instead of moving the books.

Now demonstrate this with Excel:
"What do you suppose happens when someone else comes along and moves a book? Or you take a book from someone else's shelf?"

;-)

It's the analogy that keeps on giving...

Philo

Philo
Thursday, April 29, 2004

I prefer the "windows shortcut" analogy for explaining pointers. While it's not 100% accurate, it's accurate enough for most people.

one meeeellion dollars!
Thursday, April 29, 2004

Philo said: "Now demonstrate this with Excel:
What do you suppose happens when someone else comes along and moves a book? Or you take a book from someone else's shelf?"

What happens is that excel compensates for it (as would any well-written application if some other app started getting leary with its memory), and updates its cell references accordingly.  So, in most cases, you end up pointing at the right place. I think the library card analogy is an excellent one (unless you just prefer browsing the shelves of books rather than the cards), but what I'm getting at is that you could use a spreadsheet to teach the mechanics of pointer arithmetic - the whole linked lists deal, for example -  before starting to do it in code. Sometimes it feels like teaching programming is trying to teach two very hard things at the same time - C is hard enough without pointers. Also, with excel, you could develop exercises to reinforce the concepts _and the correct use of_ of pointers before starting to do it in code.

gh
Thursday, April 29, 2004

I usually avoid spelling corrections, but something as insidious and subliminal as 'fabolous' must be corrected.

'fabolous' => 'fabulous'

'Fabolous' is a rapper who spells out his name in his raps
Saturday, May 1, 2004

*  Recent Topics

*  Fog Creek Home