• vala@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    6
    ·
    24 hours ago

    As someone who knows how to use a debugger, I can say for sure that log debugging is fine and often my first approach. If you have a good mental model of the code and the issue, it’s usually just 1-2 logs to solve the problem.

    • silasmariner@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      1 day ago

      This is the way Although I also like:
      File 1:
      print(0.1)
      print(0.2)
      File 2:
      print(1.1)
      print(1.2)

      Minimal c+p+e effort

  • 2deck@lemmy.world
    link
    fedilink
    arrow-up
    33
    ·
    2 days ago

    To me logging combined with a quick compilation has a good flow to it. Causes you to consider what you want to see and doesn’t change the workflow if multiple stacks are involved.

  • NotSteve_@piefed.ca
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 days ago

    It drives me crazy that half my coworkers do this, including a senior dev. I’ll be on a call trying to help debug something and it makes it so difficult not being able to set a breakpoint

    • andyburke@fedia.io
      link
      fedilink
      arrow-up
      30
      ·
      2 days ago

      I console.dir and debugger; and breakpoint all day. You are allowed to mix your strategies.

        • Omgpwnies@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          23 hours ago

          and the one that keeps getting slept on for some reason, watch breakpoints - stop when foo is changed. Great for figuring out what is screwing with your data when foo mysteriously changes

    • RheumatoidArthritis@mander.xyz
      link
      fedilink
      arrow-up
      7
      ·
      1 day ago

      I used to do debuggers until I started doing embedded and dipped my feet in multithreading (2 different projects). After many hours lost because the debugger straight lied to me about which line of code has been executed, a colleague suggested that I just do a printf like a filthy beginner. And 🤩it worked🤩 and I never went back to the unreliable world of debuggers. Even though now I’m mostly working with single-threaded python scripts.

    • Quantenteilchen@discuss.tchncs.de
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      There are literally university courses which confidently state “Console logging is far more used and better so we won’t talk about a debugger here”!

      Like sure, it’s very likely to be used far more, but that doesn’t mean you shouldn’t at least offer some courses or modules about proper use of a debugger…

      • NotSteve_@piefed.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 day ago

        God, I wish. I’d throw money at whoever could implement such a thing. I guess its actually theoretically possible if you just sort of wrote the whole stack to an HDD but the amount of space that would take up lol.

        But yeah, good logging (and not excessive logging!) is also extremely important

        • anton
          link
          fedilink
          arrow-up
          1
          ·
          11 hours ago

          I guess its actually theoretically possible if you just sort of wrote the whole stack to an HDD but the amount of space that would take up lol.

          Antithesis has an interesting approach by making the entire machine deterministic at the hardware level and controlling sources of randomness with the hypervisor. I learned about it on this podcast. Sadly you can’t run it yourself, only contact them to get a quote.

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    I am guilty of this but for a different reason: setting up debugging for clis in rust is hard

    I love the debugger. I use it all the time I can. But when debugging cli it’s a pain as you need to go back in the launch.json file, remake the argument list, then come back to run debug, find out why tf it doesn’t find cargo when it’s the PATH… again, then actually debug.

    • kubica@fedia.io
      link
      fedilink
      arrow-up
      19
      ·
      2 days ago

      This is what peak performance looks like:

      console.log("before dothething");
      let r = dothething();
      console.log("after dothething");
      console.log(r);