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”.
I think “never OK” is overly proscriptive — we use the term best practice because there are less preferable solutions that are nonetheless viable — but your advice to use a proper logger is sound. Many developers don’t think to use them and they offer many benefits in terms of maintainability.
Its not a best practice IMHO. Its never OK because of the 3 alternatives that exist, and because its forbidden in some regulated jobs.
Certainly not best practice. The reason I referred to the term is that “best” implies a spectrum of acceptability, where the “never OK” end of the spectrum includes stuff like storing user credentials in plaintext.
But also, if anything but best practice was truly never OK, there are many smaller programs that wouldn’t see the light of day, and there definitely wouldn’t be any junior developers.