Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Anyone know any funny programming jokes?
740 points by arthurcolle 12 months ago | hide | past | favorite | 852 comments
Can be super esoteric or super generalized, I love it when I get them, or when I just learn something new.

One of my all time favorites. Can’t remember where I first read it (Quora?), but it’s currently my top Google hit for “balloon programmer project manager joke”. [0]


A man is flying in a hot air balloon and realizes he is lost. He reduces height and spots a man down below. He lowers the balloon further and shouts:

"Excuse me, can you help me? I promised my friend. I would meet him half an hour ago, but I don't know where I am."

The man below says, "Yes, you are in a hot air balloon, hovering approximately 30 feet above this field. You are between 40 and 42 degrees North latitude, and between 58 and 60 degrees West longitude."

"You must be a programmer," says the balloonist.

"I am," replies the man. "How did you know?"

"Well," says the balloonist, "everything you have told me is technically correct, but I have no idea what to make of your information, and the fact is I am still lost."

The man below says, "You must be a project manager"

"I am," replies the balloonist, "but how did you know?"

"Well," says the man, "you don't know where you are or where you are going. You have made a promise which you have no idea how to keep, and you expect me to solve your problem. The fact is you are in the exact same position you were in before we met, but now it is somehow my fault."

[0] https://www.reddit.com/r/ProgrammerHumor/comments/2rn8qx/i_h...

A similar joke I heard recently:

A helicopter was flying around above Seattle when an electrical malfunction disabled all of the aircraft's electronic navigation and communications equipment.

Due to the clouds and haze, the pilot could not determine the helicopter's position and course to fly to the airport.

The pilot saw a tall building, flew toward it, circled, drew a handwritten sign, and held it in the helicopter's window. The pilot's sign said "WHERE AM I?" in large letters.

People in the tall building quickly responded to the aircraft, drew a large sign and held it in a building window.

Their sign read: "YOU ARE IN A HELICOPTER."

The pilot smiled, waved, looked at her map, determined the course to steer to SEATAC airport, and landed safely.

After they were on the ground, one of the passengers asked the pilot how the "YOU ARE IN A HELICOPTER" sign helped determine their position.

The pilot responded "I knew that had to be the Microsoft building because, the response they gave me was technically correct, but completely useless."

A helicopter was flying around above Seattle...malfunction disabled... aircraft's electronic navigation and communications equipment...

....The pilot saw a tall building, flew toward it, circled, drew a handwritten sign, and held it in the helicopter's window. The pilot's sign said "WHERE AM I?" in large letters.

People in the tall building quickly responded to the aircraft, drew a large sign and held it in a building window.

The Sign was a stylized picture of the helicopter they were in, with a BIG red arrow pointing towards the pilot's window where a small cartoon pilot held up a sign saying 'WHERE AM I" in a hand-rendered Helvetica font.

The pilot smiled...yadda yadda yadda..

After they were on the ground, one of the passengers asked...

The Pilot responded "Tableau Software"

I have to note that this pilot is always getting into technical problems, and seems to know all the software companies in Seattle and how they are likely to respond - conclusion - the helicopter pilot is a project manager.

This joke must have been written by a journalist who's never been to Microsoft and doesn't bother to fact check their work, since the Microsoft campus is in Redmond and the tallest buildings there are only six stories high.

Well, I can at least tell for sure that I’m on Hacker News, now. :)

That's technically correct, but ultimately useless, information

All information is useless until it's useful

Or they didn't think it mattered if the facts are correct because it is a joke.

You must be a programmer.

Thanks, that was annoying me.

I believe the original form of this joke goes like this:

Lost man in a balloon yells down at a man on the ground “Where am I?”

The man on the ground responds, “You’re in a balloon”

The man in the balloon says “You must be a mathematician”.

“Why?” asks the man on the ground.

“Because your answer is absolutely right and absolutely useless”

The joke above is a play on the older joke you told.

O the irony of down votes on a meta joke

That's funny!

But then that becomes a paradox because the fact that the statement is useless makes it useful.

Dave's Garage has some good stories!

That’s where I heard it :)

I sent this to a project manager once, and they didnt understand nor appreciate it.

They must be a project manager.

I, perhaps appropriately, improperly calculated their threshold for humor.

No, he did't deliver the joke fast enough.

And neither did he create a jira story for delivering the joke in the sprint!!!

Project managers wouldn't read the story anyway, they cough up the headline and maybe a few lines of text and expect the team to fill in the blanks during multiple refinement meetings.

Adding another layer of indirection:


This is the comment that made me laugh, well done!

I’m a project manager and find it hilarious! But i’ve also been technical.

So you are not "project manager", but "competent project manager", which is something completely different :)

I’ve never met one of them in the wild. A rare thing indeed.

They're actually more common than engineers with understanding of project management or the concerns that they quite reasonably have. And they're way more valuable than a zug-zug eng.

I say this as a pure engineer who has been a lead many times but never a PM.

I bet a product manager would be more kind

A man is flying in a hot air balloon and realizes he is lost. He reduces height and spots a man down below. He lowers the balloon further and shouts:

"Excuse me, can you help me? I promised my friend. I would meet him half an hour ago, but I don't know where I am.

The man below produces a small object the shape of a teardrop colored a pleasing grayish blue that he proceeds to hold above his head in an inverted manner and then with a courtly, elegant bow indicates the ground the bottom of the teardrop is pointing at.

The man in the balloon flies off again, exclaiming under his breath "damn designers"

"And you got there by a bunch of hot air."

As much as I like the joke and of course understand the analogy, I don't see how, from this conversation, the programmer comes to the conclusion that he has to solve the managers problem. The manager just asked, the programmer gave a technical correct answer and the manager replied that it doesn't help him. But at no point was the programmer expected to solve the managers problem nor has he blamed him so that it's "his fault".

I think it plays around a common case of a manager saving their ass in front of superiors by shouldering the blame on an unsuspicious employee (“what were you doing all these months, what’s the state of the project, and how are you planning to deliver?”). With time the latter becomes experienced enough to not take the blame, and detects these attempts easily, because it is always happen to be “their” fault.

(Sorry if that was obvious and you meant something else.)

PM gave a jerk response denigrating the programmers attempt to help.

Thats a rehash of an old joke:

I know it soviet style:

A mathematician, a physicist and a biologist are flying in a air balloon and are lost.

They encounter a man walking below:

The biologist asks him: "do you know, where we are?"

"..." the man looks up and says nothing

The physicist ask him: "can you please tell us, where we are!"

"..." after a while the man says: "in a balloon".

The mathematician remarks, ah, he must be a philosopher. The others: "how do you know?"

"Well, for once he needed a lot of time to answer. Then his answer is correct with our objective reality. And lastly, his answer is completely useless to us."

(in eastern soviet republics, philosophy was not in high regards, because the peoples governments were supposed to be philosophical (a la Marx) government, with in theory, very high standards)

I'm reminded of a joke I heard from a talk by the philosopher Dan Dennett:

A philosopher takes his friend to a magic show. After the usual business of vanishing a few small mammals, the magician's assistant lies in a magic box, and the magician, with a dramatic flair, begins to saw through the box.

The philosopher's friend leans over and asks What do you think is really going on? The philosopher gives it a moment's thought and replies They're using illusionist skills to give us the impression that he's sawing someone in two, but really he isn't. The philosopher's friend, unsatisfied, asks Right, but how? The philosopher shrugs dismissively, That's really not my department.

A. Good joke.

B. I hate how applicable this joke is to my life. Except I'm the friend asking, then has to figure all the shit out because all the people around me with degrees cant tell the difference between their ass and a hole in the ground.

A Soviet engineer needs some plumbing done in his apartment, and calls for a plumber. The plumber arrives, does his thing, and hands over the bill.

The engineer is shocked. -'What, this is like a quarter of what I make in a month - for half an hour's work???'

Plumber shrugs. -'Well, why don't you come join us? Easy work, well paid, no responsibility - just remember to keep mum about your degree, as we're not supposed to hire academics.'

Our engineer contemplates this for a while, applies for a job as a plumber - and gets it.

All is well, good money, no responsibilites - until management requires that they take evening school classes to gain new skills and thus better build socialism. So, grudgingly, our engineer enrolls in a math class and, upon arriving, finds that the teacher wants to establish what the plumbers already know.

-'You over there - could you please come to the blackboard and show us the formula for the area of a circle?' he asks our engineer.

Standing at the blackboard, he suddenly realizes he can't for the life of him remember the formula; while a bit rusty, he soon figures out how to reason it out - furiously writing out integrals on the blackboard, only to find the area of a circle is -(pi)*r^2.

Minus? How did a negative enter into it, he thinks, going over his calculations once again. No, still gets the same result. Sweat building, he turns away from the blackboard for a moment, turning to the other plumbers watching.

As in one voice, they all whisper -'Comrade, you must switch the limits to the integral!'

American version from below:

The "you learn limits in like, 9th grade" comment reminds me of this one:

Two mathematicians are in a bar. The first one says to the second that the average person knows very little about basic mathematics. The second one disagrees, and claims that most people can cope with a reasonable amount of math. The first mathematician goes off to the washroom, and in his absence the second calls over the waitress. He tells her that in a few minutes, after his friend has returned, he will call her over and ask her a question. All she has to do is answer one third x cubed.

She repeats "one thir -- dex cue"?

He repeats "one third x cubed".

She says, "one thir dex cuebd"?

Yes, that's right, he says. So she agrees, and goes off mumbling to herself, "one thir dex cuebd...".

The first guy returns and the second proposes a bet to prove his point, that most people do know something about basic math. He says he will ask the blonde waitress an integral, and the first laughingly agrees. The second man calls over the waitress and asks "what is the integral of x squared?".

The waitress says "one third x cubed" and while walking away, turns back and says over her shoulder "plus a constant!"

I've heard a variation of that were the professor is at a bar with a couple of visiting professors. He tells them, in this town pretty much everyone is smart and he proves it by asking the waitress. (The rest of the joke is the same.)

I think the integral is

        4 * integrate sqrt(r^2 - x^2) w.r.t. x from x=0 to x=r
which is from the equation of circle with radius r centered at the origin:

        x^2 + y^2 = r^2
        => y = sqrt(r^2 - x^2)
any other way achieve the same using integration?

You can arrive at the same by slicing in nearly any manner you wish: vertical dx strips, horizontal dy strips, radial dtheta strips, concentric rings treated as rectangles, diagonal strips, literally anything you wish.

If you've never set up and worked a few, try the dx version and the dy version, then maybe fiddle with a few others. They all work.

The concentric rings one is trivial to work out. Integrate over r from 0 to R. Each ring at radius r has thickness dr, and has length 2 pi r, treated simply as a rectangle, which is "close enough" since each is arbitrarily thin. Then the integral is

int_0^R 2 pi r dr = 2pi r^2/2 from 0 to R = pi R^2.

A really pretty one cuts the circle into wedges, then rearranges them by alternating direction to make a "rectangle" approx r high, approx pi * r wide, with bumpy top and bottom. In the limit this has area pi * r * r, and can be shown to kids without needing calculus.

And it's not magic or circular, since pi is defined (in this case...) as the ratio of circumference to diameter.


Value inside the integral is area of thin triangle of height r and base rdθ.

I don't quite get the punchline. I understand how if you integrate in the wrong direction you get a negative area, but is there a double meaning here?

I believe the implication is that all the plumbers are advanced degree holders, not just the engineer.

-The idea is that all the plumbers are academics looking for the easy life. :)

The limits are the shackles of oppression, the integral is the proletariat and switching is disavowing capitalism and seizing the means of production.

That was completely unhelpful but also hilarious.

As such, a perfect russian joke.

Thank you, that's what I was going for!

I shall never look at calculus the same way again. :) Thank you, comrade!

Brilliant !

Too many levels of indirection.

They're all former academics/mathematicians!

They are all engineers in disguise.

I think I had already heard that one from a math teacher

Caught me off-guard :D

Could change it like that:

A mathematician, a physicist and a biologist are flying in a air balloon and are lost.

They encounter a man walking below:

The biologist asks him: "do you know, where we are?"

"..." the man looks up and says nothing

The physicist ask him: "can you please tell us, where we are!"

"..." after a while the man says: "yes".

The mathematician remarks, ah, he must be a logician. The others: "how do you know?"

"Well, for once he needed a lot of time to answer. Then his answer is logically correct. And lastly, his answer is completely useless to us."

I heard this one but it's a mathematician and a physicist in the balloon, and the physicist says the person must be a mathematician. As told by a math professor...

It sounds like they're in the middle of the Atlantic? Have I got it wrong, I must have because the programmer is supposed to be standing in a field.

Wait - are they dead and in heaven!?!

You must be a programmer. Those who actually checks the requirements.

Sounds more like a pedantic QA

Maybe a bug in a joke, perhaps the coordinates need fixing.

This would never have happened if the joke had been made by one of those 10X Comedians.

I think without actually getting into the 10x debate regarding engineers, we can all agree that there are definitely 10x comedians.

Analogous to programming, the average joke-teller just isn’t that funny, making 10x more achievable.

“Think of a comedian.” There probably isn’t a 10x that comedian for you.

“Find the first person to tell you a joke live next week; considering them as a proxy for average, there is almost surely a 10x comedian out there.”

There probably isn’t a 10x that comedian for you.

To me the difference in 'funniness' between a random standup special (even one that is 'good' enough to get a distribution deal) and for example some of Eddie Izzard's best is easily 1000x.

But of course my least favorite stand up special is also literally the funniest thing someone else has ever seen. So maybe it washed out in aggregate.

Kevin Hart, Sarah Silverman, Bert Kreischer - 1x

Tom Segura, Ali Wong, Nikki Glaser, Bill Burr, Mark Normand, Andrew Santino - 5x

Dave Chappelle, John Mulaney, Louis CK - 10x

Which was the first comedian you named in response to the question? Was it Kevin, Sarah, or Bert?

My hypothesis is there’s a massive spread in performance in comics, in programmers, and in most fields that are substantially creative and when people argue “there is no 10x <foo>” that it’s more like because their reference frame is higher than mine.

- Milton Jones

- James Acaster

The programmer is messing with the PM.

I think maybe the programmer has forgotten to replace the mock data with a real data feed and he tells everyone who asks the same incorrect latitude and longitude no matter where they are.

Just for fun I checked where that position would be on world map. Turns out it's in the Atlantic, quite a bit off the east coast of the US.

I also enjoy a similar one where instead of the programmer stands a statistician and instead of project manager a principal investigator. Source: https://stats.stackexchange.com/a/12745

Meanwhile, no effort is made on either side to make progress. It is not a joke about software programmer or project manager, it is about self-centered irresponsible people.

(Not my joke)

At a recent real-time Java conference, the participants were given an awkward question to answer: "If you had just boarded an airliner and discovered that your team of programmers had been responsible for the flight control software, how many of you would disembark immediately?" Among the forest of raised hands only one man sat motionless. When asked what he would do, he replied that he would be quite content to stay aboard. With his team's software, he said, the plane was unlikely to even taxi as far as the runway, let alone take off.

I thought that 'real-time Java' was the joke

I thought the punchline was going to be about waiting for garbage collection to finish

If Java had true garbage collection, it would collect itself.

Java is written in C, so it cannot.

Truffle went meta and they have java in java now, which gives some nice things.

I know this joke, but in the version I've heard it's mechanical engineering students instead of programmers, their professors instead of conference participants, and the aircraft itself instead of the flight control software.

But the structure is the same.

I think Radio Yerevan wants you to be chief announcer.

The Soviet Union's greatest accomplishment was convincing everyone else in the world that Yerevan exists.

I have been there, I tell you. You gotta believe!

This is a joke, but this was a literal chat conversation that happened between Boeing engineers in regards for the 737 MAX 8.


If the plane were my machine there would be no danger.

It wasn’t until I started working with some of the top software engineers in the industry that I became afraid of flying.

Reminds me of Arthur C. Clarke's first published short story Travel by Wire!

This is an oldie (I first heard it in the 80s) but is one of my all time favorites. While it can be told about any two classes of people it really applies to a lot of code I encounter:

  A physicist is showing a thermos to her friend, a programmer.

  "It's amazing", she said.  "You put a cold drink inside and regardless of how hot it is outside the drink stays cold".

  The programmer is suitably impressed.

  "But that's not all", she continued.  "You can put a *hot* drink inside and no matter how cold it is outside the drink stays hot".

  Now the programmer is perplexed.

  Plaintively he asks, "But how does it know?"

I think of this whenever I read code that contains a gratuitous state variable that explains the type or content of some data structure rather than make the data structure self-explaining. Even more annoying when it's a class.

Having to coordinate two variables is a recipe for bugs down the road. Seems like it should be a beginner's mistake but I see it all the time in "non beginner" code.

I first heard this joke at an AI conference...

"An engineer, a physicist, a mathematician, and an AI researcher were asked to name the greatest invention of all time.

The engineer chose fire, which gave humanity power over matter. The physicist chose the wheel, which gave humanity the power over space. The mathematician chose the alphabet, which gave humanity power over symbols. The AI researcher chose the thermos bottle.

"Why a thermos bottle?" the others asked. "Because the thermos keeps hot liquids hot in winter and cold liquids cold in summer.", said the AI researcher. "Yes - so what?" "Think about it.", intoned the researcher reverently. "That little bottle - how does it know?"

Similar physics mystery: You're a pool of water in the bottom of a bucket, looking out at the stars. Somebody spins the bucket, making the stars spin. So you (the water) arrange your molecules in a parabolic shape, thicker at the sides of the bucket and thin in the middle.

How do you (the water know)? How do you know that the stars aren't holes in a paper sheet with light shining through? How do you know the universe isn't spinning, and you're standing still?

But How Do It Know? Basic Principles of Computers for Everyone


Thank you, that was where I remembered that sentence from.. Great book!

Love the joke, but to me it points to something else than gratuitous state variables. I think of it as "if all you have is a hammer, everything looks like a nail", with the hammer being "procedurally solving problems".

Just the same, I wish make were a little more procedural.

Could you share an example of this? I could be misinterpreting this but say you're building a survey system and you need to keep track of answer types (e.g. text, date, etc) and the answer itself, how can you collapse that into one field?

Your thermos does not have a switch which you must set to "hot" or "cold" before inserting a liquid, handles solids as well as liquids, and doesn't require you to even think where the theshold might lie between the "hot" and "cold" settings. Instead it just does its best to prevent an energy exchange in either direction without having to even know the variables involved. And the "same subroutine" is basically used for different sized thermoses.

In code I see people not understand this all the time. Here's an example: let's say you present the user with their previous orders, and give them the option to filter those orders by some criterion.

The shitty way to do this is to have two variables:

    Filter* orderFilter = NULL;
    bool filterSpecified = false;

    void setOrderFilter (filter* newFilter) {
      orderFilter = newFilter;
      filterSpecified = true;
So instead of just checking if a filter has been assigned, you have a separate boolean. What happens if the boolean is true but the filter is null? What would the vice versa case even mean?

The global codebase is riddled with dumb errors like this.

Even better, let's just have the default orderFilter be the equivalent of '*'.

If there's always a filter, then there's no longer a branch at the point it's used -- that needs to be tested and maintained.

I used to work with a programmer who I found difficult because their code was an ever-increasing number of "if" statements as each new case came along. Conversely he would say coding is relatively easy and that I was overcomplicating a problem by thinking about it; all I needed to do is "add an if statement here".

Yep! On of the things I point out most frequently in code reviews are things like this. However, null is an imperfect system for capturing such state. It's not self-documenting, and it breaks down when you have more than 2 states to represent.

Languages with Sum Types represent this much more elegantly with arbitrary numbers of variants and force you to check which one you have before accessing the more specific data (e.g. the filter) inside.

I deeply disagree!

Our code is riddled with heavily overloaded meanings in a single value/domain, and if you have a variety of filters, you end up with this atrocity:

  Foo *f1; // hey, just test for NULL
  double f2; // hey, just use isnan()

  int f3; // aaaaah, crap
  bool f3_specified; // god why

  std::string f4;
  // requires heavy drugs to solve existential catastrophes
Compare that to

  template <typename T>
  struct Filter {
    bool is_specified;
    T value;

  Filter<Foo *> f1;
  Filter<double> f2;
  Filter<int> f3;
  Filter<std::string> f4;
And the variety of code that has to work with either of these examples.

What happens if the boolean is true but the filter is null?

An assertion fails miserably.

What would the vice versa case even mean?

That an assertion failed miserably.

What happens if the filter is one? Minus one? Equals to PC(IP), BP? If NULL filter has to search for NULL values in a dataset? If we are looking for NAN values in a corrupted one (this one is even more tricky)?


I'm not sure they were suggesting using type-specific sentinel values (like null and nan), but to always use null or point to a value.

I like wrapping the information in a data structure exactly as you suggested, and if you never mutate the dereferenced pointer, it's equivalent to what they proposed. Big if, though.

The best is to do this generically with https://en.m.wikipedia.org/wiki/Option_type , since this pattern comes up regularly, not just with this one domain concept of "Filter"

Another way of expressing this concept is to "make invalid states unrepresentable"

Dijkstra’s EWDs are full of examples of thinking about problems mathematically instead of operationally and then deriving elegant procedures.

Do you have any examples to point to?

100% agree - it's a quite common trap for inexperienced developers to write down every cases and conditions separately, when they shouldn't. As a similar example, instead of writing "req.source = host + port", people would write:

    if (host == "load-balancer-1.internal.dns") {
        req.source = HOSTS::LOAD_BALANCER_1;
        req.source += PORT_MAPPING[HOSTS::LOAD_BALANCER_1];
    else if (host == "load-balancer-2.internal.dns") {
        // repeat
After a few quarters of services, layers, and people being added and removed, it becomes a 500-line monstrosity and sits in every critical path. And because now it's a 500-line class (half of which is defunct, but good luck figuring out which half), nobody has time to read through it and figure out that it should have been a single assignment statement.

I think this is one of the areas that functional programming naturally steers the programmer in the right direction.

Having the two separated gives the ability to disable/re-enable the filter without losing it. That's often very useful. In other cases you're very right.

Then you'd go with `filter_enabled` or similar, which is an entirely different, separate flag. It is not coupled to what the filter itself looks like.

this is the essence of Linus Torvald’s doctrine of good taste

In something like typescript you could represent this as a union type. If I'm expecting a location I could take a string ("Baghdad"), lat long pairs, an enum, etc. With a union type I can specify that it could be any of these but they fill the same purpose. In Java I'd either do method overloading or expect to receive an object that implements a method that would give the location in a common format. The wrong way to do it would be to have a function that has both a lat/long input and a string input and just say that they're nullable and we only expect to get one of them.

I think they are referring to this sort of thing (the reader will have to use their imagination and assume there is additional functionality in this class):

  class ReadingMaterial:
    is_magazine = False

    def is_periodical():
      return is_magazine

Using a base class (e.g. a Magazine and a Book class, or something) and inheritance, is much clearer than monkeying around with state.

In graphics programming the typical example of this pattern would be when someone does bespoke computations on coordinates with a bunch of if-elses instead of deriving the proper matrix equation that "just works" due to math.

You have an Answer object that probably contains a type enum.

However, you don't need to name all variables "answerObject".

0 if the bottle is empty.

1 if its hot.

-1 when its cold :D

Ah yes the triple-boolean

Reminds me of our five value boolean we used to have: is_deleted. Woe to person who expected that to be 1 or 0. Five distinct and overloaded values were possible, though I now forget them. Probably something like pending, fully deleted, being restored, not deleted, and restored.

like linux app return codes.

A ternary logic computer to go with it: https://en.wikipedia.org/wiki/Setun

FileNotFound if it's none of those

As reported in the famous Daily WTF post:


A doctor, an architect and a programmer talk about their professions. "Mine is the oldest", says the doctor, "as everybody knows God created Eve from the rib of Adam, and that's definitely a medical operation". "Right", says the architect, "but in fact architect is even older - it's definitely an architectural project to create the world from chaos". At this point programmer kicks back in the chair and gives friends a mysterious look. "Who, do you think, created the chaos?"

I always heard this with a lawyer at the end.

The joke's context is Genesis chapters 1-2, so it wouldn't make sense to include a lawyer. Satan only shows up in chapter 3.

I wish I could give this joke a trophy.

This made me chuckle :)

As others mentioned, I've also heard this as a lawyer taking claim from the chaos.

I also heard this from a friend that heard it from Ronald Reagan, who claimed it was his favorite joke.

You win this thread. All high quality jokes.

All not mine, and definitely old - but we're a big bunch, there are lots of programmers, and not everybody heard them :) .

A programmer walks into a bar and ask for a drink. The bartender says I'll give you a drink if you tell me a programmer joke. And he says: a programmer walks into a bar and ask for a drink. The bartender says I'll give you a drink if you tell me a programmer joke. And he says: a programmer walks into a bar and ask for a drink. So he gives the guy a drink, so he gives the guy a drink, so he gives the guy a drink.

... (continued): The bartender gives him a puzzled look and says, "I didn't get it", to which the programmer responds "To understand recursion you must first understand recursion."

This is a wonderful easter egg, thanks!

Did you mean where it says "did you mean . . . "?


I think the origins of the joke is the Jargon File: http://www.catb.org/jargon/html/R/recursion.html

In a similar vein:

One day a student came to Moon and said: “I understand how to make a better garbage collector. We must keep a reference count of the pointers to each cons.”

Moon patiently told the student the following story:

“One day a student came to Moon and said: ‘I understand how to make a better garbage collector...

Disclaimer : Details nobody asked for.

These are one of the jokes originating from MIT AI Lab. And, Moon mentioned here is David Moon - one of the famous hackers from MIT AI lab.

Other such jokes from same origin [1]

[1] - http://www.catb.org/~esr/jargon/html/koans.html

An infinite number of mathematicians walk into a bar. The first one orders a beer. The second one orders half a beer. The third one orders a fourth of a beer. The bartender stops them, pours two beers and says, “You guys should know your limits.”

There is a bunch of funny problems regarding Hilbert Hotel, with countably infinite number of suits :) .

Now the programmer just waits till the stack blows up to get his free drink.

Or whether the tale is optimised

Well, that depends on the language they speak.

That's how you get out of the simulation.

I thought someone was going to raise a flag.

This recurs until the programmers runs out of stacks

Recursive till you fall off your stool.

Finally, a recursion joke that is not about infinite recursion!

Well, strictly speaking it is. There is no terminating condition- the OP simply chose to return at an arbitrary point in the recursion.

Is it? In the outer "real world" the bartender will give the programmer a drink for a joke. It could be a knock-knock joke or anything, but the programmer makes it recursive. Thus making the whole thing a joke to us, otherwise it would be a knock-knock joke embedded in a pointless programmer/bartender reference.

In the first joke level, the bartender will give the programmer a drink for a joke; it doesn't work to arbitrarily end here because "a programmer asks the bartender for a drink and the bartender gives him a drink" isn't anything like a joke to qualify at the parent level.

The next level is another layer of recursion and here the programmer can literally ask for a drink and get one even though that isn't funny in itself because it can be funny in the context of the outer joke using "he asked for a drink and got one" as a cheeky way to tell a joke to get a drink, and because it's a reference to recursion, the reason for Chekhov's Programmer in the opening sentence, so making something that qualifies as a joke to get the real world programmer a real world beer.

Seems to me like it's the earliest point it could return and still potentially work, rather than an arbitrary point?

I thought it stopped due to exhausting the bar's stock, which conveniently was limited to only three drinks.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact