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.
Can I request an Editor Week?
Do you even lift?
These aren't the 'roids you're looking for.
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).
Why do programmers start counting at zero?
I expect that this is going to annoy a lot of Fortran "programmers".
Sesame Street: Feist sings 1,2,3,4. Not 0,1,2,3. :-)
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.
Numbering items with an index starting from zero isn't counting. It's just numbering.
Teach this first, along with counting continguous elements by index substraction + 1.
It's a "C" thing. Try Pascal or other Wirth family languages instead if you want to start at 1.
Or .NET.
Maybe.
:wq
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.
Actually, in Pascal you can start your index whereever you want. For example, the following defined an array starting at 42:
10 million, but your point is well-taken - you'd refer to the ten millionth kid as 9,999,999!
1 The RIAA Will Sue
2 Happy Birthday to Marky
3 Our Lawyers'll be Contacting You
Perhaps his time would be better spent getting Facebook to work correctly or maybe its just that his method of counting doesn't work that well.
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.
Personally, I am sick and tired of seeing Microwaves that treat zero like it's a counting number. When it reaches zero it's supposed to stop, but instead they often continue for an additional second.
Youtube does the same thing. Advertisements on videos with that little countdown button. It says it delays 5 seconds, but it actually delays 6, because once it reaches zero, it waits for another second before ending.
This is grade school math folks. Zero is NOT a counting number. It's the FIRST (1) combination of a bit pattern.
So for any of you programmers out there that have been using zero in this way... STOP. It's sloppy programming, and I wouldn't hire you.
I'd like to wish Mark Zuckerberg luck in his new teaching career. He'd better start now, it will take him most of his natural life to make a dent in that number.
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.
It's a computer thing. (What is C if not a portable PDP 11 assembler?)
Do you even lift?
These aren't the 'roids you're looking for.
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 recommend indexing from 0 and using exclusive upper bounds in all languages. The number of off-by-one errors decreases dramatically in my experience.
4 lines of lyrics from Happy Birthday to You
Others beat me to the copyright jokes.
But seriously, both 0-based and 1-based counting have valid, physical meanings. A 0-based count measures the number of valid elements before this one is processed. This count of preceding elements is useful for indexing in the majority of popular programming languages. A 1-based count, on the other hand, measures the number of valid elements after this one is processed. One often needs to allocate memory for elements in a manner such that the amount of memory used at once matches a 1-based count.
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.
Because you have to start counting SOMEWHERE.
bickerdyke
Last I checked .NET isn't a language.
We don't start counting at 0. Our compilers do.
Comparing against zero is fast. Yes, even in high level languages like JavaScript if you write your loop in reverse it goes faster because your compare will be against zero instead of some in-memory or register value. Do some assembly level programming. At that level it's blatantly, smacked in the face, obvious.
It's a "C" thing. Try Pascal or other Wirth family languages instead if you want to start at 1.
...or pretty much any language that didn't crib its syntax from C.
Thinking that counting from 0 is a programming thing is a sure indication of a person with a very narrow experience with programming languages. The most programmer-abusive set of them at that.
.Net is 0
00.01.02.03.04.05.06.07.08.09
...
...
10.11.12.13.14.15.16.17.18.19
20.21.22.23.24.25.26.27.28.29
30.31.32.33.34.35.36.37.38.39
0000 0001
0010 0011
0100 0101
0110 0111
1000 1001
1010 1011
1100 1101
1110 1111
10: PRINT "Everything old is new again."
20: GOTO 10
No, its not "a computer thing" computers don't "count". They increment binary numbers. They don't have arrays; they have RAM and indexing features.
Nearly all programmers don't interface directly with computers, they use programming languages. How programming languages index their arrays is entirely up to the programming language designers. Different ones do it differently. C's designers chose to do it in a way that allowed their compiler writers to do as little work as possible (which is how they made most every language decision). C became popular, so a lot of languages copied it. But a lot more did not. (Ada for example allows the user to pick their own array indices for their own convenience, rather than the compiler writer's.)
Don't confuse historical accidents with holy writ.
Your whole post is very time-cuboid, but I especifically got brainfucked by:
'empty' (a form of zero)
This is the kind of crap that comes from programmers trying to think in the machine domain rather than the problem domain, which in turn comes from fucked up hybrid languages like C++.
(I mean, I'd accept the excuse, "C++ gives you high level tools but is also close enough to the machine to allow efficient programming," if anyone actually programmed efficiently these days. But increase in software complexity should NOT require me to have two orders of magnitude clock speed increase.)
In the mish mash of legacy components wrapped up in the .NET architecture and the various third party components in frequent usage, I've run into all kinds of things indexed at 1. Thus the 'maybe'.
:wq
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
I've heard of 1 based counting (0,1,2,3,4, etc)
I've heard of 2 based counting (0,2,4,6,8, etc)
I've heard of 5 and 10 based counting (0,5,10,15, etc. or 0,10, 20, 30, etc.)
and so on,
but wouldn't 0 based counting just give you 0,0,0,0,0?
and though BCPL arrays are zero-origin, the language doesn’t support pointer arithmetic, much less data structures
In BCPL the only way of addressing arrays is by pointers. Pointers are fundamental. Variables can contain pointers to data (vectors), procedures, vectors of procedures etc. If you see that the only way of making structures is to use vectors and pointers you see that zero-indexing is fundamental.
> 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 fromHappy Birthday to Youbyusing zero
Happy Birthday is copyrighted, so you better get permission or you'll get a good education on numbers with lots of zeroes.
(-1: Post disagrees with my already-settled worldview) is not a valid mod option.
Yeah, yeah, yeah, and testing against zero is usually computationally cheaper in hardware. You're right, but you're wrecking an ancient jest.
Female programmers can only count to nine without taking their shoes off, but male programmers can count to ten by just unzipping.
That chestnut's as traditional as "why do programmers always get Hallowe'en and Christmas mixed up", you know? Have some respect for the history!
I LIKE that Mark. If I were on the fBook, I would click a button 4u.
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.
Sure its a computer thing - computers just count 2 states, zero and one ;)
Invaders must die
the basic arrays, generic list, etc... are all 0 I can't think of anything in the .Net framework itself that indexes at 1 but I've seen 3rd party classes with indexes that start at 1 and it is annoying.
C is merely a wrapper for assembly that's suffering from various wardrobe malfunctions.
Ooo. I like that.
Faster! Faster! Faster would be better!
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.
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
Software industry, is there nothing you cannot deliver late, not even a simple description of a loop?
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Those who count from 0 and the other 10 types.
Kids naturally start counting at zero. "I have zero breakfast from my parents today, I'll be fed for zero dollars at school." "I'll learn zero about ... today...".
If the lowest counting number you know is one, then you have a real problem. "I don't know how to count how little Mt. Dew I have, I don't know what I'll dew ..."
If 0 is now then new 1, what represents nothing?
...only 9999999 kids get the invitation email?
When you make a video, that is not a public performance. It is a cover recording. Now, if he had released it as audio only, he would only have to purchase a mechanical license for something like $0.07 per copy. Granting mechanical licenses is mandatory for the copyright holder and the price is set by the government. Unfortunately, mandatory licensing does not apply to audio-video sync licenses, which is what you need if you make a video. AV sync licenses must be purchased directly from the copyright holder and he is free to refuse your request or charge any price he wants for it.
In practice, this means that little people like you and me can not get one. It also means that for us there is no legal way to post covers on YouTube. Now, YouTube has agreements with some copyright holders (we don't know which ones), who decided to not prosecute us for doing so in exchange for putting ads next to our videos. This means that you usually get away with it, but occasionally might roll some bad luck, get sued for millions, go bankrupt and starve to death. Kind of a russian roulette.
Mark Zuckerberg is big enough to negotiate a license, but he might do us all a service if he spent that money on lobbying congress to update copyright laws for the digital era. Like, for example, by extending mandatory licensing to all contexts and work types, not just audio covers.
Thinking its not a programmer thing shows ignorance.
Just because not all programmers use languages that start indexing at zero doesn't make it any less of a programming thing. And for reference, you can start your indexes at 1 in C too if you want, just adjust your base offset properly.
I'd say if anything, you're the one showing narrow experience, but I know nothing about you ;)
Persistent Volume manager for Kubernetes - https://github.com/dwimsey/openshift-pvmanager
0 AM, otherwise notated as 00:00:00 on a 24-hour clock. So, the first hour is labelled zero, the first minute is labelled zero, and the first second is labelled zero. (Ask me about milliseconds...! ;-)
We starting counting at infinitely many gods. Then we moved on to just many. The Abrahamic religions have moved on to just one. ... and they've almost converged on the correct answer. :-)
> 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.
0 is the first number, so everything should start at 0. When you're born you aren't 1 you're 0, 0 is the logical first place to start for counting.
>0 is the first index of a typical storage location, it isn't because it is useful for counting, it is because it is base10.
This is to bring your typo about base10 to your attention so you can correct it before you get flamed.
Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
I think when you throw in a sports star your credibility gets divided by zero.
I am Bennett Haselton! I am Bennett Haselton!
AC's comment.
Slashdot's we site.
It's thing? No, its thing.
Damn it, I've been doing it wrong all this time. Damn English. Maybe "Ive" been doing it wrong; I don't know any more! Maybe I dont know. Crap.
Exactly the reason why I'm confused when the people where I work refer to C++, C#, and .NET separately on occasion.
Unity? Screw that: XFCE. Slashdot Beta? Screw that: SoylentNews. Australis? Screw that: Pale Moon. UX developers DIAF
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:
0 is the first number, so everything should start at 0. When you're born you aren't 1 you're 0, 0 is the logical first place to start for counting.
0 may be the first non-negative number, but the first counting number (aka positive number) is 1.
Also, if you happen to be chinese, you are 1 when you are born (which depending on your politics is a reasonable rounding given the fact that 9>12/2 ).
I'm confused. Does this mean we all have one less friend than we thought, or one more?
"The wisdom of the Patriarchs was that they *knew* they were fools." --Master Foo
Both types of counting are useful in various circumstances. As a piano teacher, it always bugs me how counting time starts at one (1,2,3,4, 1,2,3,4 etc.). No matter what your opinion for starting with zero or one in a programming context, it is insane to start from one when counting time, but tradition has the final word unfortunately.
Placing down apples on a table, or referring to an element in an array is more arguable, but perhaps the most 'accurate' (though not the most practical) method is to count in pairs: 0..1, 1..2, 2..3 etc. This way you're referring to an apple which isn't a single point in mathematical space, but rather a RANGE of points from 0 to 1. This way half an apple makes sense too.
Why OpalCalc is the best Windows calc
> 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.
Or you are counting from a point where you can only count up (.ie. I inherited a back-log of bugs of which zero have been fixed). Zero is the value at which you *start* counting and you stop when the number of fixed bugs equals the total # of bugs in your back-log.
We can dice it anyway we want, counting is counting, independent of reference, or direction.
In that instance, you're counting down the number of bottles left.
I open the fridge door. I start counting UP from zero. If there are no bottles, then I stop at zero.
I am not counting DOWN because there wasn't ONE bottle to have counted down from. I would be counting down if I said "I've just taken one bottle out and now there are zero", but that's still counting, and that's not the situation I spoke of to start with.
How to count in Binary, Octal and Hexadecimal.
I never really questioned it. Mainly because I started with Basic, but quickly moved into 6502 assembler on the C64. Really stupid example that creates a 30 element array on the zero page with the set [1, 4, 7, 10, .....]
Array = $00
LDX #$01
LDY #$00
loop:
STX Array,Y
INX
INX
INX
INY
CPY #$1E
BNE loop
If I started my index in the Y register with 1 my first element would have been placed in memory location $01 and the array would have been 29 elements long. Instead I start it with 0 and my array goes in $00 through $1D and consists of 30 elements. It had always been my assumption that 0 indexed arrays were a carry over from this.
There's no reason that a high level language can't use indexes that start with 1. It just feels really strange to me using a language that does.
Post anonymously - For when your opinion embarrasses even you!
Zuckerberg to confuse 9,999,000 kids to get 1000 kids who can correctly count starting with 0.
Kids naturally start counting at zero. "I have zero breakfast from my parents today, I'll be fed for zero dollars at school." "I'll learn zero about ... today..."
Why does it feel like there's some kind of comment being made here about the National School Lunch Program?
No I think he nailed it right there :-)
This is quite easy to do with Perl. A box with nothing in it has an undefined value. A box with something in it - even it's 0 or empty string has a defined value.
No sane programmers use the G word :-)
When you're born you're 9 months old. Maybe we should start with fractional years :-)
I liked the idea of teaching "number lines" by height above the ground. Dig a hole it's negative. Stack blocks above it's positive. The ground is 0.
I guess technically you are lol, but in either case you're still not 1.
... in which you can specify whatever you want for your lower and upper indices and the compiler just figures it out for you. C requires the programmer to confuse "counting" and "indexing" and wind up doing them wrong. Zero, rather than meaning "nothing" like it does in the rest of all meaning, means "the first" - which is not counting one. I never expected that after all these years I'd still be programming so close to assembler.
But, since you're "1" 3 months after birth though, that's why we need fractional years ;-)
LOL! Well we could make a language that uses fractions. So if your array had 10 index's the first would be Array[1/10]
Or, we could use, say, Perl and do it in an associative array like so
@years_so_far{map{'0.'.$_;}(0..8)} = ('womb') x 9;
$years_so_far{'0.a'} = 'milk';
$years_so_far{'0.f'} = 'beginning solids';
and so on ;-) and teach fractional hex while we're at it.