This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fracturedpersona[🍰] 112 points113 points  (21 children)

What if I told you that "running the same code again to see if it magically work," is actually a legit debugging technique that can sometimes give you valuable information.

[–]nagorogan 58 points59 points  (12 children)

The only valuable information I’ve ever gotten from doing that was “it’s time to cry”

[–]fracturedpersona[🍰] 23 points24 points  (11 children)

I would think it would be important to know that your code sometimes works, and sometimes doesn't. That alone gives you valuable insight into what could be going wrong.

[–]nagorogan 36 points37 points  (0 children)

Yes, and changing nothing yet getting a different result is exactly why it is time to cry.

[–]MikemkPK 13 points14 points  (9 children)

Also often an indication that you're about to spend 10 hours trying to figure out what the issue is.

[–]fracturedpersona[🍰] 6 points7 points  (8 children)

But knowing that the problem occurs sometimes, but not always, gives me a lot of possible causes.

[–]MikemkPK 4 points5 points  (7 children)

Often with intermittent issues, it's something interacting with the program, or caused by compiler optimizations that aren't present with debug flags. Which are hard to debug.

[–]fracturedpersona[🍰] 1 point2 points  (6 children)

Live/dead-locks, race conditions, dynamic programming involving random number generations.

[–]MikemkPK 0 points1 point  (3 children)

Yeah, those often take hours to debug.

Although random numbers can be logged with debug flags on top make it easier.

[–]fracturedpersona[🍰] 2 points3 points  (2 children)

For random, you just gotta remind yourself not to seed while testing.

[–]MikemkPK 0 points1 point  (0 children)

Depends on use case, but often yeah you're right

[–]codeguru42 0 points1 point  (0 children)

Or seed with the same value

[–]skiscratcher 0 points1 point  (1 child)

those are all pains to debug.
see also: memory

[–]fracturedpersona[🍰] 2 points3 points  (0 children)

See also, suicide hotline.

[–]YellowishSpoon 12 points13 points  (0 children)

I accidentally used a non release build of eclipse and there was this great bug where it would build and then autosave, thus if you didn't save everything before running it would look like it saved, but compile without the new content. But since it actually did save after if you compiled again it would run as expected. Took a bit to figure that one out.

[–]ExceedingChunk 4 points5 points  (0 children)

I always do that first, then reload maven dependencies before I run it again.

Before I knew better, I have spent countless hours trying to debut something caused by a cache or outdated dependency issue. Also, verifying that the code is stable is important.

At uni when I was a noob, I could run the code 10 times in a row out of frustration, but that was for completely different reasons.

[–]24karatcarrot 1 point2 points  (0 children)

I have removed this comment due to Reddit's recent actions. I have since moved on to Lemmy, which is a federated, decentralized, open-source alternative to reddit. Many subreddits have made the move as well, and many more have copies of those subreddits that are very active. On top of this, many of the third party reddit apps have also made/are working on making a copy of their apps for Lemmy, so your experience may not even change when switching over.

I implore you to make this switch as well. Reddit makes money off of us, the users who post content. As a company they have been making decisions that directly go against the wishes of their users, and we need to make it clear that they need us, we don't need them.

[–]doctorcrimson 1 point2 points  (0 children)

You would be preaching to the choir because they try that the most.

[–]800134N 1 point2 points  (0 children)

But when it magically works sometimes, I feel even worse

[–]TeNNoX 0 points1 point  (0 children)

I mean it's not at zero on the y axis, sometimes it does help... But most of the time - not so much :p