Lista de suposições incorretas em que programadores acreditam

Essas idéias erradas levam a centenas de bugs ou comportamentos inesperados.

Nomes:

  • People have exactly one canonical full name.
  • People have exactly one full name which they go by.
  • People have, at this point in time, exactly one canonical full name.
  • People have, at this point in time, one full name which they go by.
  • People have exactly N names, for any value of N.
  • People’s names fit within a certain defined amount of space.
  • People’s names do not change.
  • People’s names change, but only at a certain enumerated set of events.
  • People’s names are written in ASCII.
  • People’s names are written in any single character set.
  • People’s names are all mapped in Unicode code points.
  • People’s names are case sensitive.
  • People’s names are case insensitive.
  • People’s names sometimes have prefixes or suffixes, but you can safely ignore those.
  • People’s names do not contain numbers.
  • ...

Tempo:

  • There are always 24 hours in a day.
  • Months have either 30 or 31 days.
  • Years have 365 days.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
  • A week always begins and ends in the same month.
  • A week (or a month) always begins and ends in the same year.
  • The machine that a program runs on will always be in the GMT time zone.
  • Ok, that’s not true. But at least the time zone in which a program has to run will never change.
  • Well, surely there will never be a change to the time zone in which a program hast to run in production.
  • ...
  • The offsets between two time zones will remain constant.
  • OK, historical oddities aside, the offsets between two time zones won’t change in the future.
  • Changes in the offsets between time zones will occur with plenty of advance notice.
  • Daylight saving time happens at the same time every year.
  • Daylight saving time happens at the same time in every time zone.
  • Daylight saving time always adjusts by an hour.
  • Months have either 28, 29, 30, or 31 days.
  • The day of the month always advances contiguously from N to either N+1 or 1, with no discontinuities.
  • There is only one calendar system in use at one time.
  • There is a leap year every year divisible by 4.
  • ...

Geografia:

  • Places have only one official name.
  • Places have only one official name per language.
  • Place names follow the character rules of the language.
  • Place names can be written with the usual character set of a country.
  • Place names can be written with the exhaustive character set of a country.
  • Places have only one official address.
  • Countries have capitals.
  • Buildings do not move.
  • ...

Endereços:

  • An address will start with, or at least include, a building number.
  • When there is a building number, it will be all-numeric.
  • No buildings are numbered zero.
  • Well, at the very least no buildings have negative numbers.
  • We can put those funny numbers into the building name field, as no buildings have both a name and a funny number.
  • A building number will only be used once per street.
  • A building will only have one number.
  • When there's a numbered street and a house number, there will be a separator between them.
  • ...