Zuckerberg To Teach 10 Million Kids 0-Based Counting
theodp writes "'Why do programmers start counting at zero?' wondered Mike Hoye, questioning the conventional programming wisdom. Code.org will soon introduce the practice to a hoped-for audience of 10 million schoolchildren as part of Computer Science Education Week's Hour of Code. In a tutorial created by engineers from Microsoft, Google, Twitter and Facebook that's intended to introduce programming to kids as young as six years old, an otherwise breezy lesson featuring look-ma-no-typing Blockly and characters out of Angry Birds and Plants vs. Zombies, a Mark Zuckerberg video introducing the concept of Repeat Loops includes an out-of-place JavaScript example that shows kids it's as easy as 0-1-2-3 to generate 4 lines of lyrics from Happy Birthday to You by using zero-based numbering with a For-loop and ternary If statement. Accompanying videos by Bill Gates on If Statements and basketball star Chris Bosh on Repeat Until Blocks show the Code.org tutorial is still a work-in-progress. That's no big deal, since CSEdWeek has pushed back the delivery date for final Hour of Code tutorials from its prior little-time-for-testing due date to Dec. 9th, the first day of a five-day period during which teachers are expected to deliver the lessons to 10 million students."
Iterating through offsets beginning with zero is simply not counting. The writer is confused.
Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Why do programmers start counting at zero?
We don't. We start indexing at zero (in some languages), because that's usually the offset of the first useful location in an array (ie, addr + 0).
So, is that (dec) ten million kids or (dec) two million?
Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
Careful there, Z -- that might count as a "public performance" of Happy Birthday. I know you're rich, but the payment for and audience of 10 million might be kinda high.
Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
It is an indicator of a shift off the first position.
Programmers don't count starting at zero. They index items in collections starting at zero, because it makes certain actions more convenient when you're working at a very low level. But when it comes time to count the items, they start at 1 like everyone else.
No, it's actually an assembly language thing, where you access array elements by base address and offset. Your first element sits at offset zero. C is merely a wrapper for assembly that's suffering from various wardrobe malfunctions.
Are those YouTube features personally tailored?
Also I'm pretty sure that theodp is breaking the Flickr T&Cs by linking directly to the image.
Counting is an algorithm, like long division or the use of logarithmic tables--in this case an algorithm for assessing the exact numerosity of a set of objects. It consists of reciting a memorized stretch of blank verse ("one, two, three, four, five, ...") while uniquely pairing each foot in the poem with an object in the spotlight of attention, without skipping an object or landing on one twice. Then, when no object remains unnoticed, you announce the last foot you arrived at in the poem as the numerosity of the set.
This is just one of many possible algorithms for ascertaining numerosity. In some societies, people pair up the objects with parts of their body, and I know several computer programmers who count like this: "Zero, one, two three, four. There are five."
--Steven Pinker, The Stuff of Thought, p. 141
The biggest mistake in teaching mathematics is learning to start counting at one. That's fine if the only math ever learned is basic arithmetic; but higher order concepts including fractions, algebra, and number sets beyond whole numbers become much more difficult as a result. Why do we start counting at zero? Because zero is "Origin". When we count, what we are actually doing is this: I have zero. Adding one, I have one. Adding one, I have two. Adding one, I have three. Etc. By using zero as our origin, we can teach arithmetic using the integer set, rather than the whole number set. We can teach that the minus sign just means a change of direction, and that addition and subtraction are actually the same thing. So addition/subtraction is nothing more than repeated counting - a shortcut. Multiplication and division are repeated addition. Fractions are just another way of expressing division. Exponents/roots are repeated multiplication. "If you can count, you can do math. Everything else is a shortcut." Counting from zero allows us to teach euclidean coordinates / geometry as an extension of what students already are familiar with, rather than something new. Why do we start counting at zero? Because zero is "Origin".
If you are going to teach idiomatic loops, do it correctly. It's not
but
Note that in the second, idiomatic version your actual number of lines appears.
Note also that the two conventions are strongly related.
I started reading the article linked to in, "start counting at zero", and stopped halfway through. I feel sorry for anyone who reads that article, but isn't a programmer (hell, even if they are programmers), as it is self-contradictory crap:
From the article:
Itâ(TM)s not about [pointer math] because pointers and structs didnâ(TM)t exist....So I found [the person who originally decided to start array indices at zero] and asked him [why he started array indices at zero].
Then the father of zero-index arrays said:
...if p is a pointer p+1 is a pointer to the next word after the one p points to.
He then goes on to admit that zero-index arrays are the most efficient means of calculating memory addresses, and brushes aside his self-contradictions by saying that the "why" is more important than the "how".
Which means, as should be obvious to everyone, that zero indices are the most natural way to express pointer arithmetic; internally to your language runtime if your language doesn't support pointers, or externally if pointers are programmer-facing.
The author of this article needs to brush up on computer fundamentals before self-publishing his absurd opinion pieces on computer fundamentals. Zero-index arrays are "conventional programming wisdom" because they have always been the easiest way to calculate memory addresses.
Even well into adulthood, people are still confused by, e.g., the difference between "the early 1700s" and "the early 17th century" (which is actually the 1600s). Turns out, whether you like it or not, the first place value of 10^2, 10^3, 10^4, etc. you count through is always the 0th one. It's only in the very specific circumstance of counting the 10^1 place and when all the other 10^x place values are zero that the 0 gets skipped. Why not be consistent?
Besides being more consistent, I also think it is more intuitive (barring the fact that we are culturally inducted into thinking that it isn't). If you were counting *backwards,* say, starting with ten cookies and removing one cookie off a plate each time, it would be perfectly intuitive to you that you should count down to zero cookies, taking the very last cookie off the plate. The zero cookie limit is enforced by physical reality, while the one cookie limit is enforced by your arbitrary decision to interrupt your process of removing cookies and leave one cookie on the plate. Likewise, in the reverse process, you should also start your counting at an empty plate.
When things get complex, multiply by the complex conjugate.
We don't start counting at 0. Our compilers do.
I think introducing zero-based counting to older children is a good idea. For younger children, this is a mistake.
"You have ten fingers Zoe."
"No I don't. I have nine. See? 0,1,2,3,4,5,6,7,8,9 -- 9!"
Teaching young children zero-based counting, before they can count is like teaching them the Greek alphabet before they learn their ABCs.
Proverbs 21:19
We often say that immediately after starting to job on the track we are on first lap. Then we reach our second, then our third, and so on, updated each time we cross the starting point. But I hate this and would much rather start with zero. Does anyone else feel the same way? I liked to say to myself, "I've completed no laps," then "I've completed one lap," and so on, instead of "I'm on my first lap," and "I'm on my second lap." Better to count what one has already done instead of what one plans to do.
Because you have to start counting kids from ZERO.
Don't you guys read your own articles?
If telephones are outlawed, then only outlaws will have telephones.
Those who count from 0 and the other 10 types.
That hasn't been true for 30 freaking years. Stop repeating crap your tired old, hasn't worked with a real computer in the past 2 decades, crap professor spewed at you.
What processor takes more than 1 cycle to test a value other than 0? Educate me, please.
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
> I start counting at zero. "I have zero bottles of Mt. Dew, it is time to go to the store."
In that instance, you're counting down the number of bottles left. And zero is the value at which you *stop* counting.
Also FatPhil on SoylentNews, id 863
The author of exple.tive thinks that it's all about execution, efficiency, which his sources clearly indicate it's not -- but he's so hung up on execution efficiency being the most important thing in his mind that he doesn't even realize what his sources are saying. It's actually all about ease of programming. The logic of offsets is easier to follow when indexing from zero. Full stop. (That said, as others have mentioned, people still count from one.)
Just to enforce counting from 0..9.
Have gnu, will travel.
There was a contest for the smallest program that produces as output its own source code. Count the characters in the winning entry, which follows:
What processor takes more than 1 cycle to test a value other than 0? Educate me, please.
You can often do away with the extra test altogether when you're comparing against zero, provided the decrement operation sets the condition bits. It's also fairly common to have dedicated counters and "decrement and branch if not zero" opcodes. If you're comparing against a non-zero constant, and the compiler doesn't optimize the comparison away, that's at least one extra instruction and one extra cycle in the body of the loop. In optimized code the space required for the extra opcode can be just as important as the time to perform the extra arithmetic.
Counting up from 0 to 99 in PowerPC assembly:
Counting down from 100 to 1:
or even
"The state is that great fiction by which everyone tries to live at the expense of everyone else." - Bastiat
If all you want to do is to test for equal/not equal, you don't need a subtraction. You can just do a bitwise comparison.
Of course the way you'd do it in hardware is to xor the corresponding bits and test the result against zero, so at the fundamental level you're right. But the circuit is so simple that I'd expect it to still finish in one cycle, so a processor implementing that would not necessarily be slower in comparing a value to zero than in comparing two values to each other.
However usually the processor, when doing arithmetic, already does certain tests anyway, and one of those tests you get "for free" is the test for zero. So in many cases (especially in the case of loops), the test for zero needs zero additional instructions; it's part of the loop arithmetic anyway.
The Tao of math: The numbers you can count are not the real numbers.