Archived

This topic is now archived and is closed to further replies.

graveyard filla

has this ever happend to you?

Recommended Posts

high, im almost done with my pacman clone, well, id say 80% complete. anyway, have you ever discovered a bug, that made you tare your hair out all damn day? you try everything, switching the way things work, try this, try that, blah blah, then FINALLY! you fixed it. but, you cant figure out WHY this bug is happening. you fixed it, but you dont understand why your original way of doing of codeing was causing this bug. i mean, ive followed the flow of my program over and over and over and over again, and for the life of me i cant figure out why my original code was causing this bug. the new code works perfect, the bug is gone, but i cant just figure out WHY my old code wasnt working. i mean, by all god damned logic, it SHOULD work. (can you tell i spent ALLLLL day trying to fix this bug ). anyway, its really bothering me that i cant figure out why my original code was causing this bug. my new code fixes it, but i dont see why my old code was causing this, by all logic, both the new and the old code should do the same thing. anyway, i was just wondering, has this ever happend to you? if so, do you think i should spend more time ripping my hair out trying to figure out the cause of the original code''s bug? or do you think i should quitely walk away, and just be happy i fixed it? is it worth the madness, or should i just work finishing the game? thanks for your help!!

Share this post


Link to post
Share on other sites
Sure it happens.

The general story is this, continuing from where you left off. You'll shake your head and move on, letting the working code continue to work. As time goes on, you will forget what wasn't working in the first place and sooner or later, you will end up trying it again and it will explode, again. A while longer down the line, you decide to try it again. You know perfectly well it didn't work the last 2 times, but you (foolishly?) decide to try again. And it'll break. Again. This time, though, you'll find that you've been coding long enoughm that you know what exactly the problem is and how to make it work. Unfortunately, it was a staggeringly stupid mistake. So then you go back to the last 2 projects and rewrite it again, but working. It'll explode once or twice in that process, but since you have a working template, it'll go smoothly. Eventually, you'll post on a forum and laugh about it. Some other newbie will repeat your exact mistakes, and they will also post. Some not quite helpful soul will direct them to Google; another will tell them to search the forum. A third will actually hunt down your post and link them to it. They will figure it out and finally get it working. Then they will post about it, somewhat more seriously, and then people will bash the original method that was breaking to begin with. They will suggest new, improved methods that don't suck. You will eventually read these threads, notice the better methods, and you will have to go back to the last three projects and fix them. Along the way, it'll break a couple times for good measure, but the friendly people on the forum will help you get it working. Depending on how things go, you might actually make some improvements on them and end up with a pretty damn slick way of doing things. Then some newbie will come along, copy-paste your code into their project, watch it magnificently explode in a lethal barrage of threatening, scary, and utterly incomprehensible error messages that are spewed from the linker and compiler in angry tongues of flame. They will be completely confused and come back to post on the forum about it. They will post on at least 3 different forums, and of course most of those will get locked. After being reprimanded several times for cross-posting, he will be reprimanded several times for copy-pasting code which he doesn't understand at all. Once the flames have finally died down, said newbie will try to do it himself. They will then find themselves at the position of not getting one method to work, but changing something and having it work. At this point, they will usually post on a forum, patting themselves on the back and asking if anyone else has had similar experiences. And I think you know where the story goes from here.


Wow, that's going to be a real bitch to read when I hit the "Reply To Topic" button.

[edited by - Promit on March 17, 2004 6:20:17 PM]

Share this post


Link to post
Share on other sites
Yes, I once spent a whole day looking for a bug. In the end I realised I had done a sizeof(MYFVF) instead of sizeof(myvertex), so i was using 4 instead of the size of the struct. But that part just looked ok so I kept looking at all the other parts.

Share this post


Link to post
Share on other sites
Happens constantly. I''m never satified with the second solution - always wanna make the first one work - which then might take weeks to get straightened out.

So my advice : if you can : be happy with the second solution, it''ll save you a lot of time



The Monkey is back !

Share this post


Link to post
Share on other sites
my comp sci professor once said : a bug you haven''t understood isn''t a solved bug... so yes, you should look at the code a little more. bugs you don''t understand typically arise when you haven''t fully understood your language. not a tragedy at all but you want to look into it or else you might face the same bug again without havin a "known to work" solution.

Share this post


Link to post
Share on other sites
I agree with the professor.

If you don''t know WHY, then I promise it''ll return.

The only time its acceptable to rewrite from scratch to fix a bug is when you KNOW what the bugs in the old code are and why they are, and they''re just too hard to solve with that code.

Share this post


Link to post
Share on other sites
If you''re really stuck on a bug, take a break. I usually go take a shower and it pops in my head. I believe the psychological term is "incubation".

I learned my lesson the hard way never to leave out a glEnd() in OpenGL, especially if you''re using alot of them. It never generates an error, yet your graphics start doing weird stuff since ogl is state based. I literally wasted 4 hours or so because of that one function call

Share this post


Link to post
Share on other sites
quote:
Original post by C-Junkie
I agree with the professor.

If you don''t know WHY, then I promise it''ll return.

The only time its acceptable to rewrite from scratch to fix a bug is when you KNOW what the bugs in the old code are and why they are, and they''re just too hard to solve with that code.


Very true. Also, if something "works" and logic tells you that it shouldn''t, it doesn''t. It''s just fooling you into thinking it works.


"Gay marriage will encourage people to be gay, in the same way that hanging around tall people will make you tall." - Grizwald

Share this post


Link to post
Share on other sites