Skip to content
DevMeme
3476 of 7590
CS Fundamentals Post #3811 · source on Telegram

Zero-Based Counting: A Family Matter

Description

A four-panel comic strip in the style of Cyanide & Happiness, titled 'Programmer dads be like'. In the first panel, a father figure tells his young son, 'count to ten'. In the second panel, the son begins counting, '1, 2...'. The third panel shows the father crying, saying, 'you're not my son'. The final panel depicts the sad-looking child sitting alone on the steps of a building with a red sign that reads 'ORPHANAGE'. The joke is a classic in the programming community, revolving around the concept of zero-based indexing, where arrays and lists in many programming languages start their index from 0, not 1. The father, a stereotypical programmer, expects his son to start counting from zero. The son's failure to do so leads to this extreme and humorous reaction, highlighting a fundamental disconnect between a programmer's mindset and the conventional way of counting

Comments

14
Anonymous ★ Top Pick That kid will never understand the off-by-one errors he just introduced into his life
  1. Anonymous ★ Top Pick

    That kid will never understand the off-by-one errors he just introduced into his life

  2. Anonymous

    Kid started counting at 1, so Dad moved him to OrphanageService - around here, off-by-one errors are handled by garbage collection

  3. Anonymous

    The real tragedy isn't the orphanage - it's that the kid will grow up using MATLAB or Fortran where arrays start at 1, forever bringing shame to the family's git history

  4. Anonymous

    This perfectly captures the existential crisis every programmer faces when asked to count naturally - after years of `for(int i=0; i<n; i++)`, starting at 1 feels like a syntax error in real life. The orphanage ending is the logical conclusion when your parent-child relationship throws an IndexOutOfBoundsException because you're not at position 0

  5. Anonymous

    House policy: loops are [0, n); start at 1 and you’re adopted by MATLAB and Lua

  6. Anonymous

    Parent calls exit(0) sans waitpid(): kid's now init's headache, orphanage edition

  7. Anonymous

    Programmer dad turns “count to ten” into a boundary test: expected [0,10), kid returned [1..10]; classic off-by-one - reassigned to the MATLAB team

  8. Deleted Account 4y

    I know company, which uses 1 as an first array index, instead of 0, in their apis. And that is really confusing.

    1. @Daler_XYZ 4y

      Bruh

    2. @nuntikov 4y

      Matlab moment

    3. Deleted Account 4y

      lua lua

    4. @Agent1378 4y

      Pascal, pl/sql and others do that too. The C is the only reason everybody does it like this now. And C does that because it is actually assembly for lazy people and it does not care. And the array index is just used for relative adresing, so obviously it starts with 0.

      1. @CcxCZ 4y

        https://python-history.blogspot.com/2013/10/why-python-uses-0-based-indexing.html?m=1 Languages that use associative arrays exclusively like AWK and Lua do not care, they could start at "A" like spreadseets and it'd be all the same, it's just a convention. And then there is Ada where range of allowed indices is part of the type signature of the array and it could go from 5 upwards if you really wish. Or index with any enum.

        1. @Agent1378 4y

          Yes, in pascal you can also define any range and use it.

Use J and K for navigation