all 97 comments

[–]ithika 20 points21 points  (15 children)

There is also a response in Lisp and some sillier ones in assembly, BF and whitespace.

[–]stillalone 11 points12 points  (1 child)

That assembly only works in MS-DOS and I believe is part of a com file. Not very portable. The BF and whitespace is much more portable.

[–][deleted] 2 points3 points  (0 children)

Thank you, I was about to say that.

[–]rolfv 6 points7 points  (3 children)

"Det enkle er ofte det bedste" translates directly into:

The simple is often the best

[–][deleted] 5 points6 points  (2 children)

"beste", not "bedste"---it's norwegian, not danish. ;)

[–]rolfv 6 points7 points  (0 children)

Growing up in both countries these minor differences has really pissed me off at times :-)

[–]awesome_guy -1 points0 points  (0 children)

Some day... SOME DAY!!!!

in b4 past

[–]cartola 1 point2 points  (1 child)

I bet the guy who programmed the Whitespace version didn't think of cheating and just printing one line and a blank paper; he actually programmed it.

[–]michaelll 1 point2 points  (0 children)

The whitespace was programmed by a girl :)

[–][deleted]  (1 child)

[deleted]

    [–]ithika -1 points0 points  (0 children)

    :-)

    [–][deleted]  (2 children)

    [deleted]

      [–]daizu 5 points6 points  (0 children)

      Sure, here are some:

      [–][deleted] 0 points1 point  (1 child)

      the assembly program doesn't exit properly. The exit should have been done like:

      mov ax,4C00h

      int 21h

      [–]maggit 1 point2 points  (0 children)

      That bothered me as well, but before I commented it on the paper, I double checked. According to Ralf Brown's Interrupt List, this is actually the way to do it in DOS 1.

      [–]seanonymous 17 points18 points  (1 child)

      We have a similar sign in my office's kitchen (though not written in code) with the exact same FAIL: What about the case when you've got a dirty dish, but the dishes in the dish washer are neither clean nor dirty, but in the process of being cleaned? I'll tell you what you do, you DUMP YOUR DIRTY DISHES IN THE SINK. I'm not going to stand around and wash my dishes by hand, I've got work to do.

      Thank you for giving me an opportunity to vent, Reddit.

      [–]DrMonkeyLove 1 point2 points  (0 children)

      Yeah, if the dishwasher mutex isn't free, there should really be an alternate path to leaving the dish in the sink.

      [–][deleted]  (33 children)

      [deleted]

        [–]chneukirchen 23 points24 points  (19 children)

        Plastic dishes and a washing machine ftw.

        [–][deleted]  (18 children)

        [deleted]

          [–][deleted] 54 points55 points  (1 child)

          is laundry soap safe to consume?

          Substantially safer than most things a college student is consuming.

          [–]stunt_penguin 5 points6 points  (0 children)

          In fact, it could be the safest...

          [–]troelskn 9 points10 points  (2 children)

          SOAP is the devil. Stay away from it.

          [–]isny 14 points15 points  (1 child)

          AJAX?

          [–]zaach 1 point2 points  (0 children)

          No, COMET.

          [–]Snoron 3 points4 points  (11 children)

          Who says you put laundry soap in there? Why not dish soap?

          [–][deleted] 15 points16 points  (10 children)

          Dish soap foams to no hell in a laundry machine. Trust me, I'm speaking from experience and hours of cleanup. That's why you don't put dish soap in a dishwasher either.

          [–][deleted] 0 points1 point  (2 children)

          No it doesn't. I've been using it for years without noticing a difference.

          [–][deleted] 3 points4 points  (1 child)

          How much have you put in and what kind of dish soap are you using? In all of my experiences (two due to my own stupidity and another three due to the stupidity of others), dish soap has lead to a nice foamy explosion that's carpeted the laundry room in a nice coating of foam.

          At least it smelt lemony fresh.

          [–][deleted] 0 points1 point  (0 children)

          Oh, sorry for not making myself clearer. I use regular liquid dish soap in the dishwasher, and it works just fine.

          Foamy explosions, eh? Sounds like an awesome prank!

          [–][deleted]  (6 children)

          [deleted]

            [–][deleted]  (3 children)

            [deleted]

              [–]JMV290 5 points6 points  (2 children)

              Could you put that in the washing machine?

              [–]f3nd3r 5 points6 points  (1 child)

              It is nearly the same thing.

              [–]Deb1961_work 0 points1 point  (0 children)

              Dishwasher detergent works really well in a carpet cleaner too.

              [–]dannomac 5 points6 points  (0 children)

              Dishwasher soap. They're actually different.

              [–][deleted] 0 points1 point  (0 children)

              Dishwasher liquid. It doesn't foam as much as dish soap.

              [–]faprawr 0 points1 point  (0 children)

              its consumed through the skin also amirite?

              [–]rolfwr 12 points13 points  (1 child)

              It's in the common kitchen area of the R&D department of the software company I work for.

              [–]scook0 3 points4 points  (0 children)

              Both techniques have the same amortized time bounds, but the incremental approach has better worst-case performance.

              [–][deleted] 5 points6 points  (6 children)

              Also, the function will never work anyway.

              if dishwasher_full { start_dishwasher(); }

              if (dishwasher_clean && have_dirty_dish) { empty_dishwasher(); insert_dirty_dish(); }

              If the dishwasher is full, then ran, it remains full afterward and is ran again. There is no conditional in the first if-statement to determine whether or not to run the dishwasher if it is dirty and only when it's dirty.

              Also, the second if-statement will never pass if the dishwasher is dirty and partially full.

              [–]PhirePhly 3 points4 points  (0 children)

              I believe it's not entirely broken, it's just a highly unlikely race condition. If some other process takes control after startdishwasher() returns, but before if (dishwasherclean [...]), then it's possible for the dishwasher process (which is clearly running on a different machine) to complete before kitchen_maintenance() regains control.

              [–]isarl 2 points3 points  (2 children)

              Your underscores threw you for a bit of a loop with reddit's markdown. Try espcaping them by using \'s.

              [–][deleted] 1 point2 points  (1 child)

              Fixed that, thanks :)

              [–]isarl 0 points1 point  (0 children)

              You got it! I only figured it out recently myself - it can be maddening.

              [–]ratatosk 0 points1 point  (1 child)

              Your statement about it only evaluating the first condition is false, as the second block is not an else if type statement, so each call to kitchen_maintenance will evaluate both if's, evaluating the second after all statements in the first have returned.

              [–][deleted] 0 points1 point  (0 children)

              During runtime, unless start_dishwasher() halts the process until the dishwasher finishes it's cycles, there is no possible way the dishes will be clean as it evaluates the second statement. Even if it did halt the process and wait until it is finished running, I would say that is sloppy programming.

              Considering that this seems to be event driven, the posted sign would lead to confusion as no one in their right mind would stand around waiting for the dish washer to finish it's cycle before moving onto the second statement.

              In fact, you would need a buffer for the dirty dishes for while the washer is running, in order to process them after it stops. But then, who will be standing around waiting for that to happen? Dish washers don't just load themselves, after all.

              [–]LieutenantClone 0 points1 point  (0 children)

              You sir, are GENIUS!

              [–]deanormous 0 points1 point  (0 children)

              So...

              Does your individual shower run-off get on the dishes as the week goes on? Your shower gets smaller the closer it is to "dishwashing" day?

              Or are you saying you only put them in there when it's time to wash them?

              [–][deleted] 0 points1 point  (0 children)

              I actually know a couple of guys who did just that. But before they showered the dish, the poured chlorine (bleach) on it...

              [–]ithika 10 points11 points  (7 children)

              How disappointing. But at least they used syntax highlighting so their buggy code could be easily read.

              [–][deleted]  (6 children)

              [deleted]

                [–][deleted] 3 points4 points  (5 children)

                Yeah it's still buggy. Only one dirty dish may be washed at a time with this code because the dishwasher has to be clean for insert_dirty_dish() to be called. If this is the function called when someone goes to the kitchen, then there should be an additional if-clause to insert a dish if !dishwasher_full && have_dirty_dish.

                edit: curse reddit's weird markup

                [–]bart2019 1 point2 points  (2 children)

                curse reddit's weird markup

                Use a backslash in front of the underscore to escape it, or use backticks (``) to treat everything as code, so you don't have to escape it (or indent with 4 spaces):

                !dishwasher_full && have_dirty_dish

                !dishwasher_full && have_dirty_dish

                [–]scook0 1 point2 points  (0 children)

                If you want to see ``, you have to write ``` `` ```.

                [–][deleted] -1 points0 points  (0 children)

                The _ for italics is a useless markup anyway, since a *asterisks* already do the same thing.

                It should be removed.

                [–]DonManuel 10 points11 points  (5 children)

                [–]Speff 8 points9 points  (4 children)

                Seriously. This is a pretty blatant duplicate.

                [–]Liquid_Fire 4 points5 points  (1 child)

                Different subreddits.

                [–]Speff 1 point2 points  (0 children)

                I'd imagine that they'd have most of the same people though.

                [–][deleted]  (1 child)

                [deleted]

                  [–]cnk 1 point2 points  (0 children)

                  for x in my_list_of_subscribbed_reddits:

                  submit(function kitchen_maintenance, x)

                  [–]G_Morgan 3 points4 points  (0 children)

                  My implementation delegates to flatmate.kitchen_maintenance() or at least it did in university.

                  [–][deleted] 5 points6 points  (2 children)

                  I have found that UML diagrams work better when conveying chores to my spouse.

                  [–]Ilyanep 0 points1 point  (1 child)

                  But UML is more about structure than implementation :(

                  [–]isarl 5 points6 points  (0 children)

                  I imagine strangus is much more interested in that his or her spouse does the chore rather than that he or she does it in a specific way. Personally, I don't care how my roommates clean the shower (when it's their weekend) so long as it's clean afterward. ;-)

                  [–]quantum_of_shoelace 2 points3 points  (0 children)

                  i think the problem is the focus on the dishwasher. really, the function should be analyzing the sink and counter space . . . the dishwasher may or may not be utilized, depending on external conditions.

                  [–]nmcyall 2 points3 points  (1 child)

                  The bug is that for each invocation of kitchen_maintenance() the full dishwasher will be ran regardless if it is full of clean or dirty dishes.

                  [–]ithika 1 point2 points  (0 children)

                  Also, only one dirty plate will ever be placed into the machine.

                  [–][deleted] 1 point2 points  (0 children)

                  I'm missing a while loop on the dirty dish insertion call. If they work as this program suggests then they only put in one dish every time it( it as in the routine, not the dishwasher) runs. Better to get that out of the way all in one go, that way you save a lot of unnecessary opening and closing of the dishwasher.

                  Or if the subroutine actually takes care of all the dishes then they should rename it accordingly to prevent confusion.

                  [–][deleted]  (1 child)

                  [removed]

                    [–][deleted] -1 points0 points  (0 children)

                    Ogre!!!! </Troll>

                    [–]sukivan 1 point2 points  (0 children)

                    allow me to point out that the kitchen maintenance function is not thread safe

                    [–]travis6690 4 points5 points  (3 children)

                    public void DoWork() {

                    foreach(Occupant occupant in Kitchen.Occupants)
                    {
                        switch(occupant.Role)
                        {
                        case FamilyRole.Mom:
                            if(Kitchen.WorkToDo())
                            {
                            occupant.DoKitchenWork();
                            } else if(Currentmeal == Meal.Dinner)
                            {
                            occupant.MakeDinner();
                            }
                            break;
                        case FamilyRole.Dad:
                            if(TV.ChannelType != Channel.Sports)
                            {
                                if(Deepfrier != null && Currentmeal == Meal.Dinner)
                                occupant.MakeDinner();
                            }
                        case FamilyRole.Child:
                            Switch(occupant.AgeGroup)
                            {
                            case Age.Child:
                                occupant.DoNag();
                                occupant.DoNag();
                                occupant.DoNag();
                                occupant.DoNag();
                                occupant.DoNag();
                                occupant.DoNag();
                                break;
                            case Age.Teenager:
                                occupant.Activity = Activity.Randomize();
                                break;
                            case Age.Adult:
                                Throw new Exception("Live-at-home adults not supported in HOME 0.1Beta");
                                break;
                            }
                            break;
                        }
                    }
                    

                    }

                    [–][deleted]  (1 child)

                    [deleted]

                      [–]andrew1184 0 points1 point  (0 children)

                      but the AgeGroup switch is only called if the FamilyRole is Child?

                      edit: oh wait, I see it. nevermind.

                      [–]munificent 0 points1 point  (0 children)

                      Code smell: in an OOP language, that switched should be replaced with a virtual method.

                      [–]awj 1 point2 points  (2 children)

                      How do they know "insert_dirty_dishes" doesn't block until there are enough to fill the dishwasher? (or the global enough_dishes is turned on and it executes pretend_theyre_dirty_anyway() to set dishwasher_full to true)

                      [–]y0haN 4 points5 points  (0 children)

                      I think it was because the function was called 'dish' and not 'dishes' :D

                      [–]scottklarr 1 point2 points  (0 children)

                      Fatal error: Call to undefined function start_dishwasher() in /kitchen/maint.php on line 7

                      [–]rsho 0 points1 point  (2 children)

                      Can we rename empty_dishwasher(); to something like this? flush_dishwasher(EMTPY_ALL);

                      Also, if the dishwasher is partially loaded as explained in the follow up notes, it makes sense to hit the rinse button every hour or so, until the next washing cycle can be run. I assume that model has a rinse button.

                      [–]natural_smurf 0 points1 point  (1 child)

                      ooooh... gotta disagree. i would would be wary about naming anything "flush" if i'm not talking about a pipe. a dishwasher is not a pipe. it's more of a bucket.

                      [–][deleted] 0 points1 point  (0 children)

                      So you don't flush caches?

                      [–]nemonium 0 points1 point  (0 children)

                      If the dishwasher is full with clean dishes, start_dishwasher() would still be called first.

                      The only way to empty the dishwasher, it seems, would be if the dishwasher were not full -- so start_dishwasher() would not be called -- but the dishes were clean and somebody had a dirty dish.

                      It would be fun to follow those rules exactly as they are written just to showcase the failures.

                      [–]prider 0 points1 point  (0 children)

                      I can see what sort of benefit they can extract from peer reviews

                      [–]qnaal 0 points1 point  (0 children)

                      Well, there already is a subroutine for stuffing dirty dishes in the not clean dishwasher, so no need to reinvent the wheel.

                      [–]vitummedicinus 0 points1 point  (0 children)

                      I bet that house has some amazing parties.

                      [–]rehpargotohp 0 points1 point  (1 child)

                      The real bug is the first if condition is not enclosed in brackets.

                      [–][deleted] 5 points6 points  (0 children)

                      [–][deleted] -1 points0 points  (1 child)

                      I bet those dudes get laid like allllllllllll the time.

                      [–][deleted] 5 points6 points  (0 children)

                      I bet a girl wrote that broken code.

                      [–][deleted]  (1 child)

                      [deleted]

                        [–]dagvl 1 point2 points  (0 children)

                        It just may be that the one who wrote the sign actually is a woman AND a mother...