views:

1519

answers:

26

It's Thanksgiving in the United States tomorrow.

Please describe your favorite method of cooking turkey in the form of runnable code using your favorite language. For example in Java with java.utils.concurrency.

+45  A: 

In C:

while (fork());

Place turkey on your favorite multi-core CPU array, execute above code.

As a bonus, you can use the leftover forks later to eat the turkey.

Greg Hewgill
+14  A: 

Of course, in Python you wouldn't actually cook anything, just do:

import turkey
Ali A
..As long as you didn't have to implement turkey
Ellery Newcomer
+12  A: 

If you have Boost, you should use boost::turkey.

Steve Jessop
Maybe I should write a bot, and see how long it takes to go past my rep just by scanning C++ questions for keywords and posting this answer.
Steve Jessop
That's actually quite funny since there's invariably one answer to every question "How do I X?" which states "You should use boost::X." +1 from here.
paxdiablo
+1 for the extra comments here
Nathan Fellman
+28  A: 

I don't really get involved in the cooking process (my wife would balk at that). So, I would handle it afterwards like this:

Assembly language:

       mov si,turkey    ; point fork at turkey
       mov cx,capacity  ; stomach capacity
next:  lodsb            ; load single byte
       int 29h          ; consume it
       loop next        ; repeat until done (CX=0)
       jmp couch        ; watch football
BoltBait
I don't really know assembly, but wouldn't that mean that you never get to watch football?
hangy
The question was about cooking, though.
Adriano Varoli Piazza
@hangy: the x86 "loop" instruction decrements the CX register and jumps to "next" if CX does not equal 0. Once CX does reach 0, it falls through to the next instruction.
BoltBait
+18  A: 
#!/bin/bash
NUSERS=`ls /home|wc -l`
wget http://market/turkey
dd if=/dev/salt bs=2 count=1 >> turkey
dd if=/dev/pepper bs=1 count=1 >> turkey
dd if=/dev/rosemary bs=20 count=1 >> turkey
mv turkey /var/oven
/etc/init.d/oven start
sleep 60m
/etc/init.d/oven stop
mv /var/oven/turkey .
split -d -b $(( `cat turkey | wc -c` / (NUSERS-1) )) turkey meat
Federico Ramponi
Cat turkey? Is that some sort of weird new hybrid?
Adam Rosenfield
+1  A: 

cat plate | grep turkey | eat &

Adam Pierce
A: 

Complainings about me in dinning table,

  1. In delphi: "Don't only use your hands to eat!" ( Got it? Mouse only? )

  2. In C#: (This is to someone creative to make a joke about visual studio)

  3. In java: "Why it is taking you so long.."

PHP

$parts = explode($turkey, "bones");
for($parts as $part)
    eat($part);

OMG, i'm not good at this..

José Leal
C#: Why is my oven broken?or...C#: Ow, pokey!
Riddari
C# - would it be more efficient if I carved towards my fingers?
Steve Jessop
lol, this was awesome
+40  A: 

In the perversely overengineered Turkey framework, released for Thanksgiving 2008:

void CookTurkey() extends CookFood implements CookLargeAmountsOfFood,  
FamilyGathering throws FamilyMemberDrunkException, BurntTurkeyException, 
ArgumentOverHowToCookTurkeyException, HouseOnFireFromTurkeyException {
    TurkeyOven oven = TurkeyOvenFactory.createTurkeyOven(Temperature.Hot);
    try {
        iEdibleBird turkey = EdibleBirdFactory.createEdibleBird(Bird.Turkey);
    } catch(TurkeyDroppedOnFloorException) {
        CurseWord profanity = new CurseWord("#&@$@$#");
        profanity.say();
    }
    Cook cook = Cook.getSingletonInstance();  // Our cook is one-of-a-kind.
    TurkeyResult result = CookFood(turkey, oven, cook);
    if(TurkeyResult.getResult() == CookingResult.Burnt) {
        throw new BurntTurkeyException();
    }
    FamilyMembers.getSingletonInstance().eatLargeFeast(turkey);
}
dsimcha
Shouldn't it be oven.cookFood(turkey, cook)? ;)
Ace
Apart from that, +1! Turke dinner at your place must be a pretty organized feast ;)
Ace
Ok this just made me understand little more Java than I did before.
mike nvck
How about cook.CookFood(oven, turkey); ?
GalacticCowboy
Aren't you concerned about how long the "EdibleBirdFactor.createEdibleBird" method takes? :)
Tony Arkles
TurkeyOvenFactory, EdibleBirdFactory, CurseWordFactory, the instances of Cook and FamilyMembers, and a BurntTurkeyExceptionFactory, should all be passed in as parameters. Otherwise your perversely overengineered Turkey test framework will be a nightmare.
Steve Jessop
This is why I **HATE** Java.
Eduardo León
+8  A: 

Here's an algorithm developed by a few grad students a while back:

if(broke) {  // Can this branch be optimized out?
    goto seminar;
}

seminar:
free(turkey);
dsimcha
Most graduate students today (at CMU and I'm guessing that also at other places) use a free-food cam.Hence, there is a background thread that routinely checks for updates on the table in the lounge :)
Uri
+11  A: 

Real programmers stuff a turkey via SQL injection

Uri
+1 Real programmers are hackers.
Camilo Martin
+3  A: 

I'd give an answer, but my internationalization skills aren't up to par

Jimmy
+2  A: 

Chef's like Perl because nobody else can read their recipes. :P

Mike Wagner
A: 
<?php

$bird = new Turkey();
$oven = new Oven();

if( $bird->isFrozen() )
  $bird->thaw();

$oven->preHeat(Turkey::COOKING_TEMP);

$bird->season( array(Kitchen::ROSEMARY, Kitchen::SALT, Kitchen::PEPPER) );
$bird->stuff( new StoveTop() );
$oven->cook($bird);
Nathan Strong
+24  A: 

I tried to cook a turkey in Lisp, but I only ever got back a brand new turkey, fully cooked. The original was still in the oven. Then, since nobody was looking, the garbageman came and took it away.

Paul Fisher
Funniest of all :-)
e-satis
+1  A: 

Hmmm, you guys better check localization very carefully :)

leppie
+4  A: 

In delphi:

try
  turkey.Prepare();
  turkey.Cook();
  turkey.Serve();
except
  on e: EDInerIsRuined do
    pizzaLine.Order();
end;
Gamecat
Who's E. D. Iner and why would he be ruined? :-)
paxdiablo
Actually, I guess most delphi developers would just click and drag a TTurkey-component unto the mainform, and set it's activated-property to true...
Vegar
+5  A: 

Naturally, in PHP you wouldn't actually try to solve the "cook the turkey" problem.

You would instead try to hide that it, in fact, is raw and eat it anyways. Actually, whether your mouth is filled with turkey or something entirely else doesn't really matter, as you will chew on it and swallow happily nevertheless.

If your stomach would fail at some point, you would try to remember what you did earlier by doing what you did before, but at some points in the process, would stop, and look at what you have at hands. Once you have taken the peek, try to figure out how the salmon ended up in your fork, and start the process all over again.

Don't get me wrong; PHP is my current language of choice.

Henrik Paul
That describes quite well how I feel every time I use PHP.
Konrad Rudolph
A: 

stty cooked >/dev/tturkey

Windows programmer
+3  A: 

Well, it depends if Jon Skeet is the programmer or not.

He only needs to look at the turkey and it cooks.

The rest of us, not so much.

Simon Johnson
+2  A: 

Simple one in C#

public class Cook<T>
{
    public Cook(T what_to_cook)
    {
        what_to_cook.Prepare();
        what_to_cook.DoCooking();
        if(what_to_cook.ServingReady())
                what_to_cook.ServeAll();
        else
                what_to_cook.PrepareServing();
    }
}

public class MakeItHappen
{
     Turkey t = new Turkey();
     Cook<Turkey> ct = new Cook<Turkey>(t);
}

public class Turkey : ITurkey
{
     public void Prepare(){...}
     public void DoCooking(){...}
     public void ServingReady(){...}
     public void SaveAll(){...}
     public void PrepareServing(){...}

}

public interface ITurkey
{
    void Prepare();
    void DoCooking();
    void ServingReady();
    void ServeAll();
    void PrepareServing();
}
milot
add `where I : ICookable` and change ITurkey to ICookable.
maxwellb
+23  A: 

I fear for the programming industry if these unoptimized solutions are anything to go by.

Here's a (fairly) language-agnostic approach, just rewrite for your particular language:

this.Visit(Mom);

In these asynchrony times (recent C# news, case in point), I'll rewrite the above code to be asynchronous:

var ft = this.Call(Mom, c => c.Order(Turkey));
var t = await ft;
Lasse V. Karlsen
You can use prefetch functionality of mothers, like Mom.call();
nerkn
So you mean turn it into an async call?
Lasse V. Karlsen
+4  A: 

REAL programmers would use good old C-x M-c M-xmasdinner

+5  A: 

I wouldn't waste time writing custom code, I'd buy an off the shelf turkey system.

Paul Dixon
I'm glad the joke wasn't lost...
Paul Dixon
...or maybe it was! Am I the only one who always reads "Turnkey Solution" as "Turkey Solution"? :)
Paul Dixon
yes. . . . . . . . .
Camilo Martin
A: 

I don't have one for Turkey, but I do have one for Canadian Goose:

oven.setTemperature(200);
sleep(15 * 60);
oven.add(goose);
oven.add(brick);
while (!brick.isTender()) {
   sleep(300);
}
oven.remove(brick);
oven.remove(goose);
goose.dispose();
Alnitak
A: 

en-GB answer (2008 only):

sleep 28d
cook turkey
Steve Jessop
+3  A: 

First, I ask the client how they like their turkey done.

barfoon