P
pemo
After sooo many years, I've just re-read Tracy Kidder's The Soul of a New
Machine - the guy really knows how to explain things to the lay reader [thus
the Pulitzer]! E.g., an abridged extract on addressing/memory:
". the main issue was the computer's storage system. The situation resembles
that of a region's telephone system; telephones are of no use unless they
are distinct one from the other, and an item in a computer's storage system
is of no use unless it can easily be found. The general solution resembles
the phone company's; each compartment in the computer's storage has its own
'phone number,' its own unique symbol, known as an address"
When I read that I started to think if there was some 'real-world' analogy I
could use to initially discuss *pointers* in C.
On the telephone theme, I started thinking about mobile phones and wondered
whether I could use a person's number as a kind of pointer-to-person thing.
I also thought about email addresses. However, my phone number doesn't get
to 'me', it get's to my mobile - same for my email address [of which I have
many - which can 'work' here of course: many pointers to the same object].
Having rejected these though, I thought about things like ISBN, and book
[Dewey Decimal] references, e.g., 127.56.3 in our library points to K&R
[which is always there]. Dewey references - being very similar to IP
addresses, I thought about IP addresses directly, but stuck with DNS
resolved addresses e.g., using something like:
BBC * www.bbc.co.uk //A pointer to the BBC - um?
Ok, it doesn't give me *the* BBC, but a page on the BBC's website - but you
get the idea?
The website/URL thing does have one added bonus, in that pointer to
pointers - if this analogy holds - can also be factored in i.e., say, you go
to a website and find that it's moved, and that the old pages re-direct you
to the new website, e.g., by dereferencing the initial URL the
data/'information' you get is another URL which when dereference gets you to
the website you're looking for.
Anyway, I'd be interested in hearing what others think about these
analogies, and whether they think they're 'close enough' to form an initial
hook into the function of pointers. Of course, better analogies form the
real-world would be very welcome, esp. if they allow different references to
'point' to the same object [like email addresses], and, at the same time,
can be used to get the pointer-to-pointer concept across.
Machine - the guy really knows how to explain things to the lay reader [thus
the Pulitzer]! E.g., an abridged extract on addressing/memory:
". the main issue was the computer's storage system. The situation resembles
that of a region's telephone system; telephones are of no use unless they
are distinct one from the other, and an item in a computer's storage system
is of no use unless it can easily be found. The general solution resembles
the phone company's; each compartment in the computer's storage has its own
'phone number,' its own unique symbol, known as an address"
When I read that I started to think if there was some 'real-world' analogy I
could use to initially discuss *pointers* in C.
On the telephone theme, I started thinking about mobile phones and wondered
whether I could use a person's number as a kind of pointer-to-person thing.
I also thought about email addresses. However, my phone number doesn't get
to 'me', it get's to my mobile - same for my email address [of which I have
many - which can 'work' here of course: many pointers to the same object].
Having rejected these though, I thought about things like ISBN, and book
[Dewey Decimal] references, e.g., 127.56.3 in our library points to K&R
[which is always there]. Dewey references - being very similar to IP
addresses, I thought about IP addresses directly, but stuck with DNS
resolved addresses e.g., using something like:
BBC * www.bbc.co.uk //A pointer to the BBC - um?
Ok, it doesn't give me *the* BBC, but a page on the BBC's website - but you
get the idea?
The website/URL thing does have one added bonus, in that pointer to
pointers - if this analogy holds - can also be factored in i.e., say, you go
to a website and find that it's moved, and that the old pages re-direct you
to the new website, e.g., by dereferencing the initial URL the
data/'information' you get is another URL which when dereference gets you to
the website you're looking for.
Anyway, I'd be interested in hearing what others think about these
analogies, and whether they think they're 'close enough' to form an initial
hook into the function of pointers. Of course, better analogies form the
real-world would be very welcome, esp. if they allow different references to
'point' to the same object [like email addresses], and, at the same time,
can be used to get the pointer-to-pointer concept across.