Like if I’m using print statements to test my code. Is it okay to leave stuff like that in there when “publishing” the app/program?

Edit: So I meant logging. Not “tests”. Using console.log to see if the code is flowing properly. I’ll study up on debugging. Also, based on what I managed to grasp from your very helpful comments, it is not okay to do, but the severity of how much of an issue it is depends on the context? Either that or it’s completely avoidable in the first place if I just use “automated testing” or “loggers”.

  • Dr. Wesker
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    5 days ago

    It’s my opinion that typically all published apps should employ automated testing, in the form of unit tests, integration tests, and so forth.

    As far as logs and print statements go, it probably depends on the context. Like, useful feedback and debug logs are usually good. But step by step test logs not so much, especially if the end user will be inundated by them.

    • jaxxed@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      5 days ago

      This is pretty good ^

      The idea that println has a a good way to test a s incorrect. It requires a testing interaction which should be avoided. Test behaviour at the exposed interface primarily, use logging/telemetry to discover dynamics.

      The exceptions are reserved for scripty things (bash has poor logging,) ones offs (1x migration) or personal tooling.