Ryan Ryan - 1 month ago 12
Java Question

Is it good practice for a Java GUI application to print information in the Console?

So I was just sitting here wondering if it's good practice or useful to provide console updates for a GUI for what it's doing. For example, if you were moving to Screen B, would it be good to do:

System.out.println("Moving to Screen B");


Kind of an odd question to ask, but I have a few places in my code that I do that, primarily for my own use, but I was just wondering if that's a good thing to do in general or if it's typically common?

Answer

I think in most cases, no, it's just unnecessary. The only time the user would ever see your updates is when they launch your program directly from the console, which, as you can imagine, few users would do for a GUI application. As Jobin mentioned in the comments, best to output that stuff to a log.

That said, if it helps with debugging, and provides some generally useful information for that small portion of users, why not?