News for hackers. Stuff that matters.
Re:The Modern Java Platform – 2021 Edition by matsemann on Wednesday March 17, 2021 @03:09AM (#26487519)
Pair programming with colleagues I often get frustrated by them wasting time doing things a hard way. Like using print statements instead of the debugger, or setting a breakpoint but then have to skip it twenty times to get to the correct case (instead of a conditional bp), or restarting the whole server instead of hot reloading the changed class in a second.

So I think many don't know how smooth java can be if used correctly. But that also makes me think if there are low hanging fruit / obvious stuff I also don't know that could be a boost to my productivity?

Re:The Modern Java Platform – 2021 Edition by elric on Wednesday March 17, 2021 @06:04AM (#26488861)
Conditional break points are definitely a great secret weapon. But don't underestimate the value of the humble print statement. It's convenient and can often lead to surprising insights "hmm, why is this getting printed so damned much?" in a way that is sometimes more accessible than a debugger.
Re:The Modern Java Platform – 2021 Edition by blacktriangle on Wednesday March 17, 2021 @08:40AM (#26490220)
This right here, print statement debugging gets far more of a bad name than it deserves. If that's a developers only tool then sure that's a problem, but no need to hate on a very simple and effective technique just because it's often the only one people know when they are starting out.
Re:The Modern Java Platform – 2021 Edition by zaphar on Wednesday March 17, 2021 @09:23AM (#26490833)
Print debugging results in a printed log of this happened, then this happened, ..., and finally this happened. And you can trivially rewind it and do random looks at the log. Debuggers have difficulty giving you this much context at your fingertips. The downside is that if you missed one of those critical "this happened" items in your log you have to rerun. But debuggers have the same problem. If you missed a breakpoint you have to re-run.
Re:The Modern Java Platform – 2021 Edition by dropofwill on Wednesday March 17, 2021 @09:52AM (#26491223)
Intellij’s debugger has a ‘drop frame’ feature that i use a lot for going back in time when i missed something.

It also shows you the state of variables at various points alongside the code, which is basically the context i want to log anyways.

Re:The Modern Java Platform – 2021 Edition by throwawaywindev on Wednesday March 17, 2021 @09:39AM (#26491033)
You can make breakpoints that just print stuff (at least in Visual Studio)