Skip to content

Instantly share code, notes, and snippets.

@phoe
Forked from josteink/on_stateful_code.txt
Created March 9, 2016 22:42
Show Gist options
  • Save phoe/9b25188175fad6a0328f to your computer and use it in GitHub Desktop.
Save phoe/9b25188175fad6a0328f to your computer and use it in GitHub Desktop.
On why stateful code is bad
On why stateful code is bad
===========================
STUDENT: Sir, can I ask a question?
TEACHER: Yes!
STUDENT: How do you put an elephant inside a fridge?
TEACHER: I don't know.
STUDENT: It's easy, you just open the fridge and put it in. I have another question!
TEACHER: Ok, ask.
STUDENT: How to put a donkey inside the fridge?
TEACHER: It's easy, you just open the fridge and put it in.
STUDENT: No sir, You just open the fridge take out the elephant and put it in.
TEACHER: Ooh...ok!!
STUDENT: Let me ask another one. If all the animals went to the lion's birthday party, and one animal went missing which one would it be?
TEACHER: The lion of course! Because it would eat all the animals.
STUDENT: No sir, it is the donkey, because it's still inside the fridge.
TEACHER: Are you kidding me?
STUDENT: No sir, 1 last question.
TEACHER: Ok!
STUDENT: If there's a river known to be full of crocodiles and you wanted to cross, how would you?
TEACHER: There's no way, I would need a boat to cross.
STUDENT: No sir, you just swim and cross it because all the animals went to the lion's birthday party.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment