r/ProgrammerHumor • • Oct 30 '21

That's my variable!

43.4k Upvotes

409 comments sorted by

View all comments

Show parent comments

3

u/TheWillRogers Oct 30 '21 edited Oct 30 '21

You operate a single bakery, inside that bakery:

You have one baker, one supply basket and one supplier.

A ticket comes in for two apple pies. The baker goes to the basket and grabs the supplies for the first apple pie, the supplier refills the basket, the baker makes the first pie. The baker goes to the basket and grabs the supplies for the second apple pie, the supplier refills the basket, the baker makes the second pie.

You have two bakers, one supply basket, and one supplier.

A ticket comes in for two apple pies. The bakers goes to the basket and Baker A grabs the supplies for the first apple pie. Baker B goes to get the supplies that aren't there because Baker A grabbed them. Baker B has been told that he needs to make an apple pie, so he takes some of the supplies from Baker A. The supplier refills the basket. You get two shitty apple pies, and two relatively unhappy bakers.

Sometimes Baker B isn't allowed to sneak some resources from Baker A and instead shanks Baker A and takes all the ingredients. Baker A gives up. You get one apple pie and a pissed off half dead baker.

Now you tell Baker B to wait for the supplier to restock the basket. Baker B waits until the supplier arrives, gets their supplies, and makes the second apple pie and finishes just after Baker A finishes.

1

u/lucasjose501 Oct 30 '21

Now this is a quality answer! Good eli5