Katrina Owen
April 03, 2014
1.1k

# Overkill

When is it okay to build an orbital laser to destroy an ant-hill?

Many cry "overkill" when design principles are applied to trivial problems. And for good reason: in the context of work, excessive embellishment gets us into trouble. Complexity costs us time and money.

This talk explores how stepping outside of the realm of work and applying outrageous engineering practices to toy problems can deepen our understanding of the trade-offs that we make. Comically simple problems provide the perfect ground for developing actionable heuristics which can be applied to those monstrous complexities that we face in the real world.

April 03, 2014

## Transcript

9. ### README Bob is a lackadaisical teenager. In conversation, his responses

are very limited.

He answers 'Whoa, chill out!' if you yell at him. He says 'Fine. Be that way!' if you address him without actually saying anything. He answers 'Whatever.' to anything else.

Sure.

out!

out!

40. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." Iteration #1
41. ### return"Whoa, chill out!" elsif input == "Ending with ? means

a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno return"Whatever." end end end Iteration #1
42. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end Iteration #1
43. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end Iteration #1
44. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end Iteration #1
45. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end Iteration #1
46. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end Iteration #1
47. ### Iteration #1 class Bob def hey (input ) if input=="Tom-ay-to,

tom-aaaah-to." return"Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end
48. ### class Bob def hey(input) if input == "Tom-ay-to, tom-aaaah-to." return

"Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end Iteration #1 class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input =="1, 2, 3" return "Whatever." elsif input=="4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return"Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input== "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input=="" return"Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input==" " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return"Whatever." end end end

51. ### Iteration #2 class Bob def hey(input) if input == "Tom-ay-to,

tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure."
52. ### Iteration #2 class Bob def hey(input) if input == "Tom-ay-to,

tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end
53. ### Iteration #2 class Bob def hey(input) if input == "Tom-ay-to,

tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end
54. ### Iteration #2 class Bob def hey(input) if input == "Tom-ay-to,

tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end
55. ### Iteration #2 class Bob def hey(input) if input == "Tom-ay-to,

tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end
56. ### Iteration #2 class Bob def hey(input) case input when "Tom-ay-to,

tom-aaaah-to." "Whatever." when "WATCH OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end end end class Bob def hey(input) if input == "Tom-ay-to, tom-aaaah-to." return "Whatever." elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input == "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." elsif input == "WHAT THE HELL WERE YOU THINKING?" return "Whoa, chill out!" elsif input == "1, 2, 3 GO!" return "Whoa, chill out!" elsif input == "1, 2, 3" return "Whatever." elsif input == "4?" return "Sure." elsif input == "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" return "Whoa, chill out!" elsif input == "I HATE YOU" return "Whoa, chill out!" elsif input == "Ending with ? means a question." return "Whatever." elsif input == "Wait! Hang on. Are you going to be OK?" return "Sure." elsif input == "" return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == " " return "Fine. Be that way!" elsif input == "Does this cryogenic chamber make me look fat?\nno" return "Whatever." end end end

59. ### Iteration #3 class Bob def hey(input) case input when "Tom-ay-to,

tom-aaaah-to." "Whatever." when "WATCH OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?"
60. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
61. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
62. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
63. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
64. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
65. ### Iteration #3 case input when "Tom-ay-to, tom-aaaah-to." "Whatever." when "WATCH

OUT!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?" "Sure." when "You are, what, like 15?" "Sure." when "Let's go make out behind the gym!" "Whatever." when "It's OK if you don't want to go to the DMV." "Whatever." when "WHAT THE HELL WERE YOU THINKING?" "Whoa, chill out!" when "1, 2, 3 GO!" "Whoa, chill out!" when "1, 2, 3" "Whatever." when "4?" "Sure." when "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?\nno" "Whatever." when "I HATE YOU" "Whoa, chill out!" when "Ending with ? means a question." "Whatever." when "Wait! Hang on. Are you going to be OK?" "Sure." when "" "Fine. Be that way!" when " " "Fine. Be that way!" when " " "Fine. Be that way!" end
66. ### Iteration #3 class Bob def hey(input) case input when "Tom-ay-to,

tom-aaaah-to.", "Let's go make out behind the gym! "Whatever." when "WATCH OUT!", "WHAT THE HELL WERE YOU THINKING?", "1, 2, 3 GO! "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?", "You are, wha "Sure." when "", " ", " " "Fine. Be that way!" end end end
67. ### Iteration #3 ic chamber make me look fat?\nno", "Ending with

? means a question."

71. ### Iteration #4 class Bob def hey(input) case input when "Tom-ay-to,

tom-aaaah-to.", "Let's go make out behind the gym! "Whatever." when "WATCH OUT!", "WHAT THE HELL WERE YOU THINKING?", "1, 2, 3 GO! "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?", "You are, wha "Sure." when "", " ", " " "Fine. Be that way!" end end end
72. ### Iteration #4 class Bob def hey(input) case input when "Tom-ay-to,

tom-aaaah-to.", "Let's go make out behind the gym!", "It's OK if you don't want to go to the DMV.", "1, 2, 3", "Does this cryogenic chamber make me look fat?\nno", "Ending with ? means a question." "Whatever." when "WATCH OUT!", "WHAT THE HELL WERE YOU THINKING?", "1, 2, 3 GO!", "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!", "I HATE YOU" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?", "You are, what, like 15?", "4?", "Wait! Hang on. Are you going to be OK?" "Sure." when "", " ", " " "Fine. Be that way!" end end end
73. ### Iteration #4 "Sure." when "", " ", " " "Fine.

Be that way!" end end end
74. ### Iteration #4 "Whoa, chill out!" when "Does this cryogenic chamber

make me look fat?", "You are, what, like 15?", "4?", "Wait! Hang on. Are you going to be OK?" "Sure." when "",
75. ### Iteration #4 "Whatever." when "WATCH OUT!", "WHAT THE HELL WERE

YOU THINKING?", "1, 2, 3 GO!", "ZOMG THE %^*@#\$(*^ ZOMBIES ARE COMING!!11!!1!", "I HATE YOU" "Whoa, chill out!" when "Does this cryogenic chamber make me look fat?",
76. ### Iteration #4 case input when "Tom-ay-to, tom-aaaah-to.", "Let's go make

out behind the gym!", "It's OK if you don't want to go to the DMV.", "1, 2, 3", "Does this cryogenic chamber make me look fat?\nno", "Ending with ? means a question." "Whatever." when "WATCH OUT!",
77. ### Iteration #5 class Bob def hey(input) return "Whoa, chill out!"

if input =~ /\A[\dA-Z\s\W]+\z/ and input =~ /[A-Z]/ return "Sure." if input.split("").last == "?" return "Fine. Be that way!" if input.strip == "" "Whatever." end end

80. ### Iteration #5 class Bob def hey(input) return "Whoa, chill out!"

if input =~ /\A[\dA-Z\s\W]+\z/ and input =~ /[A-Z]/ return "Sure." if input.split("").last == "?" return "Fine. Be that way!" if input.strip == "" "Whatever." end end
81. ### Iteration #5 class Bob def hey(input) return "Whoa, chill out!"

if input =~ /\A[\dA-Z\s\W]+\z/ and input =~ /[A-Z]/ return "Sure." if input.split("").last == "?" return "Fine. Be that way!" if input.strip == "" "Whatever." end end

85. ### Iteration #5 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase and input != input.downcase return "Sure." if input.split("").last == "?" return "Fine. Be that way!" if input.strip == "" "Whatever." end end

88. ### Iteration #5 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase and input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip == "" "Whatever." end end

93. ### Iteration #6 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase and input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip.empty? "Whatever." end end

101. ### boolean vs control flow if hungry? && thirsty? eat and

drink and be_merry! end
102. ### Iteration #6 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase and input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip.empty? "Whatever." end end
103. ### Iteration #6 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase && input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip.empty? "Whatever." end end

106. ### Iteration #7 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase && input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip.empty? "Whatever." end end
107. ### Iteration #7 class Bob def hey(input) return "Whoa, chill out!"

if input == input.upcase && input != input.downcase return "Sure." if input.end_with?("?") return "Fine. Be that way!" if input.strip.empty? "Whatever." end end
108. ### Iteration #7 class Bob def hey(input) case when input ==

input.upcase && input != input.downcase "Whoa, chill out!" when input.end_with?("?") "Sure." when input.strip.empty? "Fine. Be that way!" else "Whatever." end end end

111. ### Iteration #8 class Bob def hey(input) case when input ==

input.upcase && input != input.downcase "Whoa, chill out!" when input.end_with?("?") "Sure." when input.strip.empty? "Fine. Be that way!" else "Whatever." end end end
112. ### Iteration #8 class Bob def hey(input) @input = input case

when all_caps? then "Whoa, chill out!" when question? then "Sure." when empty? then "Fine. Be that way!" else "Whatever." end end def empty? @input.strip.empty? end def question? @input.end_with?("?") end def all_caps? @input == @input.upcase && @input != @input.downcase end end

119. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
120. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
121. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
122. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
123. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
124. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
125. ### Iteration #9 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end

128. ### Iteration #10 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
129. ### Iteration #10 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private def silence? @input.strip.empty? end def question? @input.end_with?("?") end def shout? @input == @input.upcase && @input != @input.downcase end end
130. ### Iteration #10 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private attr_reader :input def silence? input.strip.empty? end def question? input.end_with?("?") end def shout? input == input.upcase && input != input.downcase end end

133. ### Iteration #11 class Bob def hey(input) @input = input case

when shout? then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private attr_reader :input def silence? input.strip.empty? end def question? input.end_with?("?") end def shout? input == input.upcase && input != input.downcase end end

CRAZY?"
137. ### "ARE YOU CRAZY?" @input confusion ensues B A "ARE YOU

CRAZY?" C "You’re late."
138. ### @input "You’re late." confusion ensues B A "ARE YOU CRAZY?"

C "You’re late."

143. ### private attr_reader :input def silence? input.strip.empty? end ... Iteration #11

private def silence? ->(s) { s.strip.empty? } end ...

146. ### Iteration #12 class Bob def hey(input) case input when shout?

then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private def silence? ->(s) { s.strip.empty? } end def question? ->(s) { s.end_with?("?") } end def shout? ->(s) { s == s.upcase && s != s.downcase } end end
147. ### special case case age when ->(i) { i < 13

} then "kiddo" when ->(i) { i % 25 == 0 } then "quarter" when ->(i) { i % 10 == 0 } then "decade" end
148. ### Iteration #12 class Bob def hey(input) case input when shout?

then "Whoa, chill out!" when question? then "Sure." when silence? then "Fine. Be that way!" else "Whatever." end end private def silence? ->(s) { s.strip.empty? } end def question? ->(s) { s.end_with?("?") } end def shout? ->(s) { s == s.upcase && s != s.downcase } end end

153. ### private def silence? ->(s) { s.strip.empty? } end def question?

->(s) { s.end_with?("?") } end def shout? ->(s) { s == s.upcase && s != s.downcase } end Iteration #12
154. ### private def silence? ->(s) { s.strip.empty? } end def question?

->(s) { s.end_with?("?") } end def shout? ->(s) { s == s.upcase && s != s.downcase } end Iteration #12 private def silence?(s) s.strip.empty? end def question?(s) s.end_with?("?") end def shout?(s) s == s.upcase && s != s.downcase end

157. ### Iteration #13 class Bob def hey(input) case when shout?(input) then

"Whoa, chill out!" when question?(input) then "Sure." when silence?(input) then "Fine. Be that way!" else "Whatever." end end private def silence?(s) s.strip.empty? end def question?(s) s.end_with?("?") end def shout?(s) s == s.upcase && s != s.downcase end end
158. ### Iteration #13 class Bob def hey(input) case when shout?(input) then

"Whoa, chill out!" when question?(input) then "Sure." when silence?(input) then "Fine. Be that way!" else "Whatever." end end private def silence?(s) s.strip.empty? end def question?(s) s.end_with?("?") end def shout?(s) s == s.upcase && s != s.downcase end end
159. ### Iteration #13 class Bob def hey(input) case when shout?(input) then

"Whoa, chill out!" when question?(input) then "Sure." when silence?(input) then "Fine. Be that way!" else "Whatever." end end private def silence?(s) s.strip.empty? end def question?(s) s.end_with?("?") end def shout?(s) s == s.upcase && s != s.downcase end end
160. ### Iteration #13 class Bob def hey(input) case when shout?(input) then

"Whoa, chill out!" when question?(input) then "Sure." when silence?(input) then "Fine. Be that way!" else "Whatever." end end private def silence?(s) s.strip.empty? end def question?(s) s.end_with?("?") end def shout?(s) s == s.upcase && s != s.downcase end end
161. ### Iteration #13 class Bob def hey(input) case when input.shout? then

"Whoa, chill out!" when input.question? then "Sure." when input.silence? then "Fine. Be that way!" else "Whatever." end end end class String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end

164. ### Iteration #14 class Bob def hey(input) case when input.shout? then

"Whoa, chill out!" when input.question? then "Sure." when input.silence? then "Fine. Be that way!" else "Whatever." end end end class String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end

167. ### String API #downcase #gsub #reverse #scan #squeeze #to_i ... #question?

#shout? #silence?
168. ### Iteration #14 class Bob def hey(input) case when input.shout? then

"Whoa, chill out!" when input.question? then "Sure." when input.silence? then "Fine. Be that way!" else "Whatever." end end end class String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end
169. ### Iteration #14 class Bob def hey(input) input = Input.new(input) case

when input.shout? then "Whoa, chill out!" when input.question? then "Sure." when input.silence? then "Fine. Be that way!" else "Whatever." end end end class Input < String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end

172. ### Iteration #15 class Bob def hey(input) input = Input.new(input) case

when input.shout? then "Whoa, chill out!" when input.question? then "Sure." when input.silence? then "Fine. Be that way!" else "Whatever." end end end class Input < String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end
173. ### Input API #downcase #gsub #reverse #scan #squeeze #to_i ... #question?

#shout? #silence?

end beware!

UNICORN
179. ### beware! s.sparkle # => **;* unicorn **;** s.upcase # =>

UNICORN s << 's' # => "unicorns"
180. ### beware! s.sparkle # => **;* unicorn **;** s.upcase # =>

UNICORN s << 's' # => "unicorns" s.sparkle # => **;* unicorns **;**

185. ### s1.sparkle # => **;* unicorn **;** s2.sparkle # => **;*

rainbow **;** beware!

188. ### beware! s3.sparkle # => undefined method `sparkle' for "unicornrainbow":String (NoMethodError)

s3 = s1 + s2 # => "unicornrainbow"
189. ### Iteration #15 class Bob # ... end class Input <

String def silence? strip.empty? end def question? end_with?("?") end def shout? self == upcase && self != downcase end end
190. ### Iteration #15 class Bob # ... end class Input attr_reader

:input def initialize(input) @input = input end def silence? input.strip.empty? end def question? input.end_with?("?") end def shout? input == input.upcase && input != input.downcase end end

#to_i ...

195. ### Iteration #16 class Bob def hey(input) input = Input.new(input) case

# ... end end end class Input attr_reader :input def initialize(input) @input = input end def silence? input.strip.empty? end def question? input.end_with?("?") end def shout? input == input.upcase && input != input.downcase end end
196. ### Iteration #16 class Bob def hey(input) input = Input.new(input) case

# ... end end end class Input attr_reader :input def initialize(input) @input = input end def silence? input.strip.empty? end def question? input.end_with?("?") end def shout? input == input.upcase && input != input.downcase end end

213. ### point of view shout? question? silence? ➔ freaking_out? ➔ dumb_question?

➔ cold_shoulder?

215. ### Iteration #16 class Bob def hey(remark) remark = Remark.new(remark) case

# ... end end end class Remark attr_reader :remark def initialize(remark) @remark = remark end def silence? remark.strip.empty? end def question? remark.end_with?("?") end def shout? remark == remark.upcase && remark != remark.downcase end end
216. ### Iteration #16 class Bob def hey(remark) remark = Remark.new(remark) case

# ... end end end class Remark attr_reader :remark def initialize(remark) @remark = remark end def silence? remark.strip.empty? end def question? remark.end_with?("?") end def shout? remark == remark.upcase && remark != remark.downcase end end

220. ### echoes var srcData = data; if (data.data && data.data.data) {

data = data.data.data; } else if (data.data) { data = data.data; } if (!data) { return; }

225. ### Final Solution class Bob def hey(text) remark = Remark.new(text) case

# ... end end end class Remark attr_reader :text def initialize(text) @text = text end def silence? text.strip.empty? end def question? text.end_with?("?") end def shout? text == text.upcase && text != text.downcase end end case when remark.shout? then "Whoa, chill out!" when remark.question? then "Sure." when remark.silence? then "Fine. Be that way!" else "Whatever." end
226. ### class Bob def hey (input ) if input=="Tom-ay-to, tom-aaaah-to." return"Whatever."

elsif input == "WATCH OUT!" return "Whoa, chill out!" elsif input == "Does this cryogenic chamber make me look fat?" return "Sure." elsif input== "You are, what, like 15?" return "Sure." elsif input == "Let's go make out behind the gym!" return "Whatever." elsif input == "It's OK if you don't want to go to the DMV." return "Whatever." Initial Solution

229. ### credits Simple Made Easy http://www.infoq.com/presentations/Simple-Made-Easy Rich Hickey 5 elements of

Effective Thinking Michael Starbird, Edward Burger Smalltalk Implementation Patterns Kent Beck Mark by Mark http://vimeo.com/79530470 Sarah Gray