Michael Heap
June 09, 2017
170

# Don’t believe everything you learn - PHPSouthCoast

A minute always has 60 seconds, right? Wrong! Ok, but a country always has a capital city, right? Wrong again!

Come and join us for a lighthearted talk about some of the common falsehoods that developers believe which cause issues in real, production systems. We’ll cover the classics like timezones and names, as well as some new contenders such as geography and software versions.

June 09, 2017

## Transcript

1. Don’t believe
everything you learn
@mheap at #phpsc17

2. Things we believe are true

3. Things we believe are true
But they’re not

4. Falsehoods programmers

5. Michael

6. Time

7. @mheap
The number of days in every month
starts with a 3, so either 30 or 31?

8. @mheap
The number of days in every month
starts with a 3, so either 30 or 31?
February has 28

9. #phpsc17
Each month always has the same
number of days every year though?

10. #phpsc17
Each month always has the same
number of days every year though?
February has 29 in leap years

11. @mheap
But we can calculate leap years.
They’re every four years

12. @mheap
But we can calculate leap years.
They’re every four years
Unless it’s divisible by 100

13. #phpsc17
But we can calculate leap years.
They’re every four years
(Unless it’s divisible by 100)

14. #phpsc17
But we can calculate leap years.
They’re every four years
(Unless it’s divisible by 100)
If it divides by 100 and 400, it
is a leap year

15. @mheap
But that rule holds all the time

16. @mheap
But that rule holds all the time
Unless you’re Sweden

17. #phpsc17
February is 28 or 29 days
February the 30th doesn’t exist

18. #phpsc17
February is 28 or 29 days
February the 30th doesn’t exist
Unless you’re Sweden

19. #phpsc17
February is 28 or 29 days
February the 30th doesn’t exist

20. #phpsc17
February is 28 or 29 days
February the 30th doesn’t exist
Or the Soviet Union

21. @mheap
A month starts and ends in
the same year

22. @mheap
A month starts and ends in
the same year
Not in ancient Rome

23. @mheap
A month starts and ends in
the same year

24. @mheap
A month starts and ends in
the same year
Or a modern Ethiopia

25. #phpsc17
Excluding DST, time always
goes forwards

26. #phpsc17
Excluding DST, time always
goes forwards
Shanghai, 1927
1927-12-31 23:54:08 happened twice

27. Modern Time

28. @mheap
The day before Saturday
is always Friday

29. @mheap
The day before Saturday
is always Friday
Samoa, 2011

30. #phpsc17
The offsets between two timezones
will always be the same

31. #phpsc17
The offsets between two timezones
will always be the same
10 changes in 2016
2 changes so far in 2017

32. @mheap
Timezones are always +/-
an integer number of hours

33. @mheap
Timezones are always +/-
an integer number of hours
Afghanistan, +04:30
New Zealand (Chatham Islands), +12:45

34. #phpsc17
15 minutes is safe though?

35. #phpsc17
15 minutes is safe though?
UTC-00:25:21 - Dublin Mean Time

36. @mheap
If they do change, there’ll be
plenty of notice

37. @mheap
If they do change, there’ll be
plenty of notice
North Korea, 2015
8 days notice of a 30 minute change

38. Audience Participation

39. @mheap
There are always 24 hours in a day

40. @mheap
There are always 24 hours in a day
Daylight Savings Time
Means 23 or 25 hours in a day

41. #phpsc17
Is the time 23:59:60 invalid?

42. #phpsc17
Is the time 23:59:60 invalid?
Leap seconds
A minute can have 61 seconds

43. Names
HELLO
, M
Y
N
AM
E
IS

44. @mheap
A child will have the same surname as
either their mother or father (or both)

45. @mheap
A child will have the same surname as
either their mother or father (or both)
Not in Iceland

46. #phpsc17
People have at least 2 names

47. #phpsc17
People have at least 2 names
Teller (of Penn & Teller fame)
Akihito (Emperor of Japan)

48. @mheap
People’s names do not
contain numbers

49. @mheap
People’s names do not
contain numbers
John 5

50. #phpsc17
People’s names do not
contain numbers

51. #phpsc17
People’s names do not
contain numbers
K8lyn? (Kaitlyn)

52. #phpsc17
People’s names do not
contain numbers

53. #phpsc17
People’s names do not
contain numbers
KVIIIlyn

54. @mheap
For every rule, there are
guaranteed to be exceptions

55. @mheap
For every rule, there are
guaranteed to be exceptions
No spaces
Van Buren

56. @mheap
For every rule, there are
guaranteed to be exceptions

57. @mheap
For every rule, there are
guaranteed to be exceptions
Only letters
O’Reilly

58. @mheap
For every rule, there are
guaranteed to be exceptions

59. @mheap
For every rule, there are
guaranteed to be exceptions
One capital letter
McDonald

60. Audience Participation
HELLO
, M
Y
N
AM
E
IS

61. @mheap
A name must contain one or
more alphanumeric characters

62. @mheap
A name must contain one or
more alphanumeric characters
⽑毛泽东

63. #phpsc17
A name must contain one or
more unicode characters

64. #phpsc17
A name must contain one or
more unicode characters

65. @mheap
I can safely assume that this list
of bad words has no names in it

66. @mheap
I can safely assume that this list
of bad words has no names in it
Ever been to Middlesex?

67. @mheap
I can safely assume that this list
of bad words has no names in it

68. @mheap
I can safely assume that this list
of bad words has no names in it
Eaten shittake mushrooms?

69. @mheap
I can safely assume that this list
of bad words has no names in it

70. @mheap
I can safely assume that this list
of bad words has no names in it
Been named Craig Cockburn?

71. @mheap
I can safely assume that this list
of bad words has no names in it

72. @mheap
I can safely assume that this list
of bad words has no names in it
Linda Callahan?

73. @mheap
I can safely assume that this list
of bad words has no names in it

74. #phpsc17

75. #phpsc17
Super Bowl XXX

76. @mheap
permission emails bouncing?

77. @mheap
permission emails bouncing?
Erection of a structure

78. #phpsc17

79. #phpsc17
Christopher Null

81. #phpsc17
A building number is numeric

82. #phpsc17
A building number is numeric
TS4 2HT

83. @mheap
No buildings are numbered zero

84. @mheap
No buildings are numbered zero
TS4 2HT

85. #phpsc17
If the addresses on the left are even,
addresses on the right must be odd

86. #phpsc17
If the addresses on the left are even,
addresses on the right must be odd
Seine-Saint-Denis, France
Even numbers on both sides, no odds

87. @mheap

88. @mheap
101 Alma St, Palo Alto
Apartments 1 and 001 on different floors.

89. #phpsc17
A street name won't include a number

90. #phpsc17
A street name won't include a number
8 Seven Gardens Burgh, Woodbridge,
IP13 6SU

91. @mheap
You wouldn’t name a town Street

92. @mheap
You wouldn’t name a town Street
Street, Somerset, UK

93. #phpsc17
You can’t have two towns/cities with
the same name in a country

94. #phpsc17
You can’t have two towns/cities with
the same name in a country
The UK has three places
named Newport

95. @mheap
Those cities don’t have
duplicate street names

96. @mheap
Those cities don’t have
duplicate street names
10 High Street, Newport, PO30 1SS
10 High Street, Newport, NP20 1FQ
10 High Street, Newport, TF10 7AN

97. #phpsc17
Street names will be
reasonably short

98. #phpsc17
Street names will be
reasonably short
Aleja Alije Izetbegovića Prvig
Predsjednika Predsjedništva Republika
Bosna i Hercegovina

99. @mheap
A building has a single postcode

100. @mheap
A building has a single postcode
DVLA Swansea:
V5Cs are processed at SA99 1BA,
Driving licences at SA99 1AB

101. #phpsc17
in space

102. #phpsc17
in space
BF1 4FB

103. @mheap
Concrete buildings are a fixed
point in space

104. @mheap
Concrete buildings are a fixed
point in space
In Zürich, a 6200 ton building was
moved by 60 meters to make way for
railway tracks

105. Audience Participation

106. #phpsc17
Do all countries have a
capital city?

107. #phpsc17
Do all countries have a
capital city?
Switzerland does not. The government
is currently in Bern, but the city is not
the capital

108. Commerce

109. #phpsc17
A product has one price

110. #phpsc17
A product has one price
Price with tax, price without tax, sale
price, list price, minimum price

111. @mheap
A product has a price

112. @mheap
A product has a price
Products sold on auction sites
do not have a price until it’s sold

113. #phpsc17
Currencies symbols uniquely
identify a currency

114. #phpsc17
Currencies symbols uniquely
identify a currency
The peso and dollar sign \$ is
used by many countries

115. @mheap
Currencies have a unicode symbol
that represents them

116. @mheap
Currencies have a unicode symbol
that represents them
The Swiss franc does not
Until 2010, neither did the Indian rupee

117. #phpsc17
Currencies symbols uniquely
identify a currency

118. #phpsc17
Currencies symbols uniquely
identify a currency
The peso and dollar sign \$ is
used by many countries

119. Audience Participation

120. @mheap
Locale doesn’t matter for currency

121. @mheap
Locale doesn’t matter for currency
1.000

122. #phpsc17
The currency symbol always precedes
the amount e.g. £1.50

123. #phpsc17
The currency symbol always precedes
the amount e.g. £1.50
1.50€ in Spain

124. @mheap
The currency symbol always
precedes or follows the amount

125. @mheap
The currency symbol always
precedes or follows the amount
1€50 in France

126. Computers

127. The network is reliable.
Latency is zero.
Bandwidth is infinite.
The network is secure.
Topology doesn't change.
Transport cost is zero.
The network is homogeneous.

128. (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\
["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\
[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?
[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:
(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\
[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:
(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?
[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".
\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\
[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\]
(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\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".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?
[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\
\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|
(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\
\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\
\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*))*)?;\s*)

129. In summary

130. In summary
Computers are hard

131. In summary

132. In summary
Humans make assumptions

133. In summary

134. In summary
Things are never as simple
as they seem

135. @mheap
https://joind.in/21483