Two cute programmer jokes

This one amused me…

protected void On_DayLoad(object sender, EventArgs e) {
  Beverage coffee = new Beverage("coffee");
  coffee.Add(Beverage.Sweetener.Sugar);
  coffee.Cream = false;
  Cup mug = new Cup();
  mug.Add(coffee);
  Me.Consume(mug);
  mug.Dispose();
}

Of course, you could argue that the hard-coded string in the Beverage class constructor is bad design, but it’s only a joke eh?

This one is an old one, but I liked the variation of answer…

Question: How many programmers does it take to change a light bulb?

Answer 1: None, it’s a hardware issue

Answer 2: A properly designed light bulb object would inherit a Change() method from a generic base Lighting class, so all you’d have to do is send a light bulb change message

2 Comments

  1. a cup of warm milk said:

    You ate the mug????????

    November 1, 2021
    Reply
    • Avrohom Yisroel Silver said:

      Ah, you spotted the bug in my code! Or was that the bug in my mug?

      Either way, that explains all those null reference exceptions and network time-outs I saw in that application.

      Thanks for that, I better go and do some bug-fixing!

      December 22, 2021
      Reply

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.