Print Story A programmer is going to the store to get groceries
Diary
By nathan (Fri Jan 11, 2013 at 10:32:27 AM EST) (all tags)
His wife says to him "Buy a loaf of bread, and if they have eggs, buy a dozen."


He comes back with thirteen loaves of bread.

"But why?" she asks.

"They had eggs."

< Facebook confirms | Once upon a time >
A programmer is going to the store to get groceries | 10 comments (10 topical, 0 hidden) | Trackback
Next day by TheophileEscargot (4.00 / 9) #1 Fri Jan 11, 2013 at 11:00:31 AM EST
Next day, his wife says to him, 'while you're out, get some milk'

He never returns
--
It is unlikely that the good of a snail should reside in its shell: so is it likely that the good of a man should?

Doesn't he come home with 12 loaves? by ambrosen (2.00 / 0) #2 Fri Jan 11, 2013 at 12:32:57 PM EST
That looks like an = not a += to me.

Two ways of interpreting that by riceowlguy (2.00 / 0) #3 Fri Jan 11, 2013 at 01:31:25 PM EST
1) How I think you're interpreting it:
if (!($theyHaveEggs)) {
   buyLoavesOfBread(1);
} else {
   buyLoavesOfBread(12);
}

2) How I interpret it:
buyLoavesOfBread(1);
if ($theyHaveEggs) {
   buyLoavesOfBread(12);
}

[ Parent ]
Third way by notafurry (2.00 / 0) #4 Fri Jan 11, 2013 at 01:52:02 PM EST
int loafCount;
set loafCount = 1;
if ($theyHaveEggs) {
  loafCount = 12;
}

buyBread(loafCount);

[ Parent ]
Being a computational linguist (by training) by ambrosen (2.00 / 0) #6 Fri Jan 11, 2013 at 04:22:22 PM EST
I'd call it a quantifier scope analysis problem.

But I'd call my reading the most felicitous.

[ Parent ]
If x and y then z by lm (2.00 / 0) #7 Fri Jan 11, 2013 at 05:00:01 PM EST
x = the action of buying a single loaf of bread
y = the store has eggs
z = buy 12 loaves of bread

That seems the most felicitous translation to me. So the programmer can return home with either 0, 1, or 13 loaves of bread.

In the case where either there is no bread to buy or the programmer has no money with which to buy bread, or there is some other impediment to buying bread, no bread shall be bought making the x portion of if x and y fail.

In the case where the programmer is able to buy bread but there are no eggs, x is true but y is false so there is only the single loaf of bread which has been purchased prior to the evaluation of whether or not there are eggs.

In the case where the first bread purchase is successful and there are eggs, then a second purchase of 12 loaves of bread will be made.


There is no more degenerate kind of state than that in which the richest are supposed to be the best.
Cicero, The Republic
[ Parent ]
Hmmm by anonimouse (4.00 / 1) #5 Fri Jan 11, 2013 at 02:49:11 PM EST
Are we doing Waterfall method or Scrum method of System Design here?

If the former, we need to wait a week whilst we wait for the Specification to be corrected, if the latter we need to resolve the issue in the next stand up meeting.


Girls come and go but a mortgage is for 25 years -- JtL
[ Parent ]
I think we're doing by wiredog (2.00 / 0) #8 Fri Jan 11, 2013 at 06:43:01 PM EST
throw it against the wall and see what sticks.

Earth First!
(We can strip mine the rest later.)

[ Parent ]
Watergile by jimgon (4.00 / 1) #10 Sat Jan 12, 2013 at 11:34:54 AM EST
Do part of the spec and let the developers start working, then do the next part and repeat.  Correct the original part of the spec based on what the developers say since you haven't finalized it.  Then finalize it once the last part of the spec is finished, but before development ends.  Start testing before either are finished. 




---------------
Technician - "We can't even get decent physical health care. Mental health is like witchcraft here."
[ Parent ]
-1: No Unit Testing by anonimouse (4.00 / 1) #9 Fri Jan 11, 2013 at 07:45:36 PM EST
No Tea


Girls come and go but a mortgage is for 25 years -- JtL
A programmer is going to the store to get groceries | 10 comments (10 topical, 0 hidden) | Trackback