• henfredemars@infosec.pub
    link
    fedilink
    English
    arrow-up
    137
    ·
    4 months ago

    All the debugging tools in the world doesn’t beat an excellent sense of intuition and putting that print statement exactly where it needs to be.

      • flying_sheep@lemmy.ml
        link
        fedilink
        arrow-up
        38
        ·
        4 months ago

        He works on Linux where he controls the whole stack down to the metal and I love that for him, but other people have to call library code, and them debug that if it doesn’t work as they thought it would.

      • Cubes@lemm.ee
        link
        fedilink
        English
        arrow-up
        5
        ·
        4 months ago

        The problem is that sometimes it’s not your code that you’re debugging

  • xmunk@sh.itjust.works
    link
    fedilink
    arrow-up
    45
    arrow-down
    1
    ·
    4 months ago

    echo __LINE__ . "Moo\n";

    Honestly if you’re not including the LoC in your debug statement I don’t even fucking understand you.

    But yeah, senior devs know the power of breadcrumb debugging (because most of us were deeply scarred by gdb).

  • Gamma@beehaw.org
    link
    fedilink
    English
    arrow-up
    27
    ·
    4 months ago

    And when you need something more complex

    console.log(1);
    […]
    console.log(2);
    […]
    console.log(3);
    
    • Aabbcc@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      “Hello worl” if I need something quick

      “AAAAAAAAAAAAAAAAA” if I’m lazy and don’t want to have to hunt the output logs for it

  • anti-idpol action@programming.dev
    link
    fedilink
    arrow-up
    9
    ·
    4 months ago

    tfw I recently worked on a side project where I was too lazy to change the log level but not sloppy enough to use raw printf so I’d just throw stuff into info and then remove the statements once I solved my issue

  • Kojichan@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    4 months ago

    Ahhh, my favourite debugging combo…

    echo "<pre>"; print_r( "We are here, we are here!" ); echo "</pre>"; die();

    Also fun at parties, hanging out asynchronously, is the ever popular PHP Mail to see if something ran in the background properly, or to get output.