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.
+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
I don't really know assembly, but wouldn't that mean that you never get to watch football?
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.
+18  A: 
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

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.."


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

OMG, i'm not good at this..

José Leal
C#: Why is my oven broken?or...C#: Ow, pokey!
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("#&@$@$#");
    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();
Shouldn't it be oven.cookFood(turkey, cook)? ;)
Apart from that, +1! Turke dinner at your place must be a pretty organized feast ;)
Ok this just made me understand little more Java than I did before.
mike nvck
How about cook.CookFood(oven, turkey); ?
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;

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 :)
+11  A: 

Real programmers stuff a turkey via SQL injection

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

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

+2  A: 

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

Mike Wagner

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

if( $bird->isFrozen() )


$bird->season( array(Kitchen::ROSEMARY, Kitchen::SALT, Kitchen::PEPPER) );
$bird->stuff( new StoveTop() );
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 :-)
+1  A: 

Hmmm, you guys better check localization very carefully :)

+4  A: 

In delphi:

  on e: EDInerIsRuined do
Who's E. D. Iner and why would he be ruined? :-)
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...
+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

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)

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();
add `where I : ICookable` and change ITurkey to ICookable.
+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:


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;
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

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

sleep(15 * 60);
while (!brick.isTender()) {

en-GB answer (2008 only):

sleep 28d
cook turkey
Steve Jessop
+3  A: 

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