Jump to content
Koumei & the Five Fates: Share Bug Reports and Feedback Here! ×

Programming People Help Me Out


TheBrsrkr
 Share

Recommended Posts

Why do things crash? No, I don't mean what causes the crash, like a missing file or an error somewhere. Why do things stop responding when it happens? Shouldn't it redirect you somewhere or give you a file not found message or something instead of imploding the entire program? I just don't get it.

Link to comment
Share on other sites

Technically, a notified crash simply means there was some exception in the code that was not foreseen, so the error-report got sent to the OS of your computer and it shuts down the program. It are often very delicate combinations of circumstances, 2 variables being substracted and another being divided by that. Only of both variables are the same, the substraction will yield 0 and the division fail, or a few conditions not being totally exclusive and things being managed wrong.

 

A program freezing on the other hand means there is no error, just that the program is operating, but yielding no result. The OS thinks, "oh, that program is still doing things, lets let it work"; while the program is just running an endless loop or similar. 

 

All errors that occur in the program should  be handled by the program itself. But this handling must be programmed as well, and thus, a programmer has to see that this error actually can happen. And in big programs, this is much more complicated than it sounds because there are so many things you have no real influence on as a programmer.

Link to comment
Share on other sites

Why do things crash? No, I don't mean what causes the crash, like a missing file or an error somewhere. Why do things stop responding when it happens? Shouldn't it redirect you somewhere or give you a file not found message or something instead of imploding the entire program? I just don't get it.

Why things stop responding in a program: 

 

The program simply cannot proceed further, or the program cannot recognise the code written, or a logical contradiction crops up (boolean algebra comes into mind). 

 

What should happen when a program crashes: 

 

Throw up error messages saying what is going on, what is missing etc., and since most programs (in fact, all the programs I encountered so far) cannot do self-repair, the default response is shutting down the whole program.

Link to comment
Share on other sites

Technically, crashes are usually causes when some part of the code reaches a problem it doesn't know how to solve, and yells "abort."

 

Think of an assembly line. One machine drills holes in a piece of wood. Before it drills, it checks to see if the drill bit is in the right place on the wood. If not, it will move it to compensate before continuing.

 

Now let's give it a problem it can't solve. The drill is in the correct place, but the piece of wood is flipped upside down. The drill bit doesn't know how to solve the problem, since no one programmed it to know what to do. Instead it yells "abort" and stops the entire machine.

 

A crash is pretty similar. Code can only do exactly what you program it to do, it can't make assumptions or problem solve on its own. Let's say a piece of code is trying to use an equation to figure out if a bullet would hit an enemy. It gets the line the bullets travels across, but an ability makes the bullet arc. The equation expects a straight line, and doesn't know how to work with a curved line. Since code can't solve this problem by itself, it yells "abort" and triggers a crash.

 

Ideally the code would need to be told how to handle such a situation. Maybe it has a separate equation that can handle curves, or maybe it just ignores that bullet entirely. The programmers need to expect these kinds of problems and teach their code how to handle them. When they don't, things break.

Link to comment
Share on other sites

Technically, crashes are usually causes when some part of the code reaches a problem it doesn't know how to solve, and yells "abort."

Think of an assembly line. One machine drills holes in a piece of wood. Before it drills, it checks to see if the drill bit is in the right place on the wood. If not, it will move it to compensate before continuing.

Now let's give it a problem it can't solve. The drill is in the correct place, but the piece of wood is flipped upside down. The drill bit doesn't know how to solve the problem, since no one programmed it to know what to do. Instead it yells "abort" and stops the entire machine.

A crash is pretty similar. Code can only do exactly what you program it to do, it can't make assumptions or problem solve on its own. Let's say a piece of code is trying to use an equation to figure out if a bullet would hit an enemy. It gets the line the bullets travels across, but an ability makes the bullet arc. The equation expects a straight line, and doesn't know how to work with a curved line. Since code can't solve this problem by itself, it yells "abort" and triggers a crash.

Ideally the code would need to be told how to handle such a situation. Maybe it has a separate equation that can handle curves, or maybe it just ignores that bullet entirely. The programmers need to expect these kinds of problems and teach their code how to handle them. When they don't, things break.

I see. That makes sense. Didn't think about the programmer's perspective. I thought it was more like 1+1=3 is wrong so BURN EVERYTHING

Anyway, thanks for tge clarification, random person on the internet.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...