
Why do we count starting from zero? - inostia
https://cseducators.stackexchange.com/questions/5023/why-do-we-count-starting-from-zero
======
ddingus
Address lines. So much boils down to address lines, and how they are binary.

Address 0000 is the lowest one, first one, initial address, right?

Well, either we start, given 4 address lines:

0000 = 0

, or

0000 = 1.

Which is it?

Either we have to talk to people about zero, address lines, various indexing
and pointer math

, or

We have to start all those conversations with some reason why 0000 = 1.

The former seems to make the most basic sense, and is rooted deep in the
hardware.

I have found explaining address lines, and the powers of two very useful. This
is how I was introduced to all of this back in the 80's, when confronting
computers, memory, hex, pages, and all sorts of basic things.

It made immediate sense. Later, moving to other higher order, and or more
complex environments, there are sometimes details needed, but those basics
really do not change much, leaving the real problem connecting whatever higher
order tools one might be using with the lower level nature of the computer
itself.

When I've gone through this, I typically use a 16 bit environment, and 8 bit
CPU example. It's 6502, 6809, Z-80 like. Does not matter much to the newbies.
We are never going to go there, unless they have an interest.

But, that tiny space, and encouragement to just memorize the first 16 powers
of two make for a great foundation!

They can easily do hex and binary with that info. ASCII, and other core
things, put into tabular listings of various kinds, all sort out pretty
easily. There are lots of examples, like 8 bit color, 24 bit color, those
weird "color numbers that have letters in them." Just one of many simple
things people can be shown, or talked to about and have it all make some sort
of sense.

Why is $000000 black? And why is $FFFFFF white? And just why are there colors
from 0 to 255, or levels of red, green, blue?

Decimal conversions are not that difficult either. Just add up all the ones
and you are done. Division works the other way. Some people won't need or want
those, so no worries. Skip them. They can return later.

Time spent on all that stuff is kind of fun time, and it pays off big. All one
needs is a white board, the calculators found in whatever teaching environment
is available, and or their computers.

Invite questions. Many people will have seen stuff, and if they ask anything
at all, that's your opportunity to connect the dots in a way that will be
useful to them and endure easily.

While there, and say it's a school setting, or the people are headed somewhere
it may be needed, we've somehow introduced this "metric" or "SI Unit Standard"
for Kilobyte as being 1000. I won't argue it, just as I would not for Imperial
vs Standard International units, as found in the USA. Not a good hill to die
on.

The better thing is to just recognize the units and know what they mean. There
are just units, they get used, and the most important thing is to know what
those units actually mean. Preferences, politics on them are fun, but
secondary.

Kilobyte - 1024, because of address lines. The other unit can make sense for
disks, packets, and other things not necessarily tied so fundamentally to the
powers of two. It's just enough that they get the differences.

Pages? While those vary considerably, the fundamental idea is each of those
powers of two can be a page. On old computers, pages were 256 bytes, 0 - 255
inclusive, for example. They were 8 bits, and that's 8 address lines worth,
which is...

Pages in modern machines and languages vary widely, but 4K seems to come up a
lot. Again, not too important, just link that concept to the address lines,
chunks of memory, etc...

And then finally some math. Bytes, words, longs, and so forth. Nibbles too. 4
bits, 8 bits, 16 bits, 32 bits.

When they do the conversions, a whole lot will make sense, and the most basic
thing, say 4 bits being 0 - 15, will make sense, as does the "page", and the
number 16 being a power of two, and how all that adds together to make most
efficient use of address lines. The colors are one super easy way to talk
about this. And they can all bring up some program and type them in, get some
sense of things that way.

Truth is, with address lines, there will be X number of them, and they have
two states. (technical issues, like floating states aside) Why do anything
other than use them? It's a waste to do otherwise, and again technical things
aside.

Having taken newbies (and I've personally done middle-school and high school
student sessions on request many times) through this stuff, they come away
with a very basic understanding about the nature of the computer.

If that's all they get, it's fine. Specific numbers, kilobyte, megabyte,
megabit, all have some basic meaning, and the unit issue stands a fair chance
of being understood too.

Other questions like, "How come it's always 8GB, or 32Kb?", or "How come we
never see a 29GB USB drive?" Have easy and obvious, if not always technically
correct, answers they will find make sense.

That all leads straight to, "Count starting from 0" having good reasons, and
it can make some basic sense. That's all people need. Should they get to a
point where it's a real debate, it's a very nice problem for them to have, if
you ask me.

Those who advance and want to do programming will build on these ideas and
have little trouble with counting from zero, and when and why it is done, or
not done.

 __Didn 't put this on Stack Exchange because I'm not on a machine with those
credentials, so here it is for anyone who might need it as an introduction for
someone new. It works well --even for very non-technical people. And BTW, the
non-technical ones will often just get it, then accept it with little more
than, "so that is why computer numbers are weird!

Great, that's the point. Just enough to build on.

And again, way back in the day, all that made so darn much sense to my peer
group. We grokked it, and literally got better at understanding a whole bunch
of things without even feeling it very much.

Finally, a CPU 8 bits, registers, and all that stuff may not be appropriate.
Depending on the audience, address lines, and the on-off state is enough. Use
houses, blinkenlights, whatever they can identify with and just link it to how
the computer can access things. Talk through 4 bits worth, and they will get
it.

Doing that is enough for understanding and for those interested to make good
progress with somewhat less stumbling.

