Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Println is fine while trying to develop something new on your local machine and understand what the heck is going on if it isn't working as expected.
Logging if you're deploying something and want to see how it does in A/B testing or something.
Unit tests - ALWAYS. It is acceptable to not have them for code you're in the middle of writing for the first time though -
@homomorphicanus I try to develop something new by writing exploratory unit tests for it
-
Neither.
Deploy at random, and try to decipher bugs from complaints made by enraged end users, poorly relayed as incomplete tickets by support nitwits. -
KDSBest7753y@C0D4 there is a certain feeling searching a 2gb log. Just to find out you log all shit, but not the one thing you need.
-
Dafuq is even this question? Println and unit testing has nothing to do with each other and is used to solve different problems.
It’s like asking "toilet brush or toothbrush?"
For logging, use a logging framework instead of println. For debugging, use the debugger and breakpoints instead of println. To prevent bugs from happening and make code better, use unit tests. -
The point of testing is to quickly verify that a codebase is in working order (esp after updating dependencies and shit). Use it.
As far as println, you want a proper logging library that offers some abstraction so you can sexy things with your log statements. Println doesn't offer that functionality. -
Do it like the abysmal CMS I have to work on:
Send every log entry via cURL to an HTTP endpoint on some company's website.
You can't imagine what I've seen in the codebase of that company's CMS... 🤡
Println or Unit Testing?
question