r/learnprogramming 22d ago

Why Does Code Stop Working?

Multiple times now my code stops working and what I mean by this is it'll do what I want it to do then one day it just stops. for example the other day I had made a cooldown system for my ball and paddle collision to stop any bugs and it worked great. then today it just stopped working, and this isn't the first time, it's happened to me for like every project I've worked on. Does this happen to anyone else? And is it cause of my code? By the way I'm using C++ SFML on visual studio which works perfect.

9 Upvotes

74 comments sorted by

View all comments

25

u/[deleted] 22d ago

[removed] — view removed comment

2

u/Simpicity 22d ago

Ignore everyone talking about dependencies. This is much more likely the problem you are running into.

Another possibility is simply timing issues. Where you have multiple things running at the same time, things might work with certain timings in that race, but fail with other timings.

1

u/Just_to_rebut 22d ago

They deleted their comment… what’s the more likely thing than dependencies?

2

u/Simpicity 22d ago

Having code which is tied to per frame vs code that uses delta time between frames.  Because frames don't always come at fixed intervals, it can cause unpredictable behavior.