2

Println or Unit Testing?

Comments
  • 2
    Unit testing + logging, the more logging the better.
  • 3
    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
  • 1
    Can't get the test working without Println :)
  • 1
    Of course println. The more, the better. 😈
  • 1
    @homomorphicanus I try to develop something new by writing exploratory unit tests for it
  • 1
    Neither.

    Deploy at random, and try to decipher bugs from complaints made by enraged end users, poorly relayed as incomplete tickets by support nitwits.
  • 1
    @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.
  • 1
    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.
  • 1
    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.
  • 1
    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... 🤡
Add Comment