• xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        10
        ·
        2 years ago

        I have a production bug… it only happens on Saturdays ever our ops folks have no idea - this can be replicated on a test server that gets no traffic.

        Saturday why!

        • lad@programming.dev
          link
          fedilink
          arrow-up
          5
          ·
          2 years ago

          If we reject the theory that it could be someone’s elaborate revenge, Saturday may be the first day of the week that may become workday or non-workday because of incorrect assumption about the first day of the week. If everywhere but one place in your software the day numeration is correct it would be a hard bug to spot.

          Also, if it is in Java, I vaguely remember there being a lot of ways to express weekday, so a lot of ways to shoot off your foot (solely on Saturday)

          • xmunk@sh.itjust.works
            link
            fedilink
            arrow-up
            4
            ·
            2 years ago

            For bonus points, this failure is in a cron job that sends out recently queued messages. It runs once every ten minutes - last weekend we had 12 failures: four were in a cluster on their own, one was in a run of two, and six were in a single continuous run.

            Please note that this server is unused by our business so no messages ever get naturally queued. Every day we sync the live production server to this server at about 9 PM - assuming an employee was queuing up a message before the snapshot is taken there might be a number of unsent messages in the snapshot - those messages will all be sent by the first cron job after the sync.

            It is a wonderfully awful problem that has me wanting to pull out my luscious locks.

              • xmunk@sh.itjust.works
                link
                fedilink
                arrow-up
                4
                ·
                2 years ago

                Yup, luck is appreciated and I’m trying to get more eyes but unfortunately I’m a senior dev that has the second highest seniority at the company so I feel guilty dragging others into it.

    • Blue_Morpho@lemmy.world
      link
      fedilink
      arrow-up
      1
      arrow-down
      1
      ·
      2 years ago

      I’ve always hated recursion. It’s always seemed like a cutesy programming trick that’s not reliable in all conditions.

      You could blow the stack in an edge case that you didn’t think of. So it should never be a standard pattern. It’s only good if you need to rewrite something for optimization and recursion is appropriate. But in many cases recursion is slower.

      “Look at what I can do in 5 lines of code!” is for programming contests, not for anything important.

  • harrys_balzac@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    27
    ·
    2 years ago

    I didn’t have to program this, thankfully. The code was used as an example of recursion but the explanation was lacking so I ended up writing out each frame by end until I understood it. Took a few pages and a couple of hours.

    I am grateful that I learned what I did going through it but I’d rather not do it again.

  • Victor@lemmy.world
    link
    fedilink
    arrow-up
    18
    ·
    2 years ago

    Is this a hard problem to solve? I’ve not attempted it yet myself.

    I seem to remember this was a problem in Advent of Code one year?

    I’m imagining there are plenty of algorithms to solve this already, right? With varying numbers of towers and plates? A general solution for solvable amounts of each? Maybe?

    • Akrenion@programming.dev
      link
      fedilink
      arrow-up
      42
      ·
      2 years ago

      This is not a hard problem once you wrap your head around it. It is the earliest that some programmers learn about recursion which has a lot of pitfalls and can be frustrating at times.

      • Victor@lemmy.world
        link
        fedilink
        arrow-up
        9
        ·
        2 years ago

        Ah okay, that’s where the trauma comes from then, perhaps? 😅 Just being new to a concept and perhaps starting out with a problem that is a little too big while at the same time learning the concept?

        • Ephera@lemmy.ml
          link
          fedilink
          arrow-up
          13
          ·
          2 years ago

          I feel like it’s maybe a bit too much to say that it’s a trauma. The Vietnam-flashback picture is just very fitting, because the puzzle is called “Towers of Hanoi” (Hanoi is the capital of Vietnam).

      • RamblingPanda@lemmynsfw.com
        link
        fedilink
        arrow-up
        3
        arrow-down
        2
        ·
        2 years ago

        Thank god my first time was building a dynamic tree with loads of metadata and sorting from database records and not some strange game 😐

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      10
      ·
      2 years ago

      It’s an easy problem to solve… eventually - it’s more annoying to solve optimally and that’s what programmers usually get handed as a play problem within a year or two of starting to tinker.

  • akash_rawal@lemmy.world
    link
    fedilink
    arrow-up
    16
    ·
    2 years ago

    Replacing “Programmers:” with “Program:” is more accurate.

    spoiler

    Tower of Hanoi is actually easy to write program for. Executing it on the other hand…

    • sv1sjp@lemmy.world
      link
      fedilink
      English
      arrow-up
      4
      ·
      2 years ago

      In myuniversity, we used to play with these to find the fastest path in AI (A*, first depth etc)