Question:
Why do programers have to carefully write every step in a process when writing instructions for a computer?
?
2017-01-10 16:25:28 UTC
Why do programers have to carefully write every step in a process when writing instructions for a computer?
Fourteen answers:
2017-01-16 00:59:45 UTC
Think if you are driving and you have directions and you have to follow them literally, because you aren't capable of improvising. Now a single turn gone wrong (late, early, wrong way, not at all) and you'll be lost, and might just end up at a dead end or down a one way street.



The computer isn't capable of realizing something is wrong and working around it, unless that functionality is added to the program.
darrenforster99
2017-01-11 21:49:57 UTC
Because a computer doesn't have thinking like humans, it can't decide if we got something wrong to correct it for us so ultimately if computer software does something we don't want it to do there is usually only two answers for why the bug is there - 99.9% of the time the reason is the programmer programmed it wrong - and about 0.1% of the time it's down to some kind of electrical/hardware glitch (e.g. the Havard Mark II bug that Grace Murray Hopper came across which really was a bug (a moth) stuck in the machine!)



Also in some cases if programs are wrote wrong and the error goes unnoticed - in some cases the error can have serious consequences - for example a number of years ago a roller coaster crashed into another one - because the programmer put a decimal point in the wrong place which the roller coaster used to figure out the correct distance between the two cars, people were injured and killed, the computer had no way to think for itself and decide that the two cars would hit each other - all it could do was run the program, and if the program led the system to believe it was safe to release the two cars then that's exactly what it did.
mark_poc
2017-01-11 15:51:21 UTC
Because a computer is like a DVD player - all it does is play the program. If you are watching a movie on a DVD player, the movie had to be carefully acted out by actors in every step in a process because the DVD player ain't gonna do it, it just plays the results of the actors.



So just like actors put together the exact way the movie plays out, so a programmer puts together exactly how the program plays out. Just like the DVD player doesn't add any creatively or substance to the movie, neither does a computer add creativity or substance to what the program does. The computer just plays the program - period.



A better way to visualize this would be with an animated movie production. In a cartoon animation, each frame of the movie has to be written exactly as the artist (programmer) wants it to be (how else is it going to happen?).
2017-01-13 03:44:33 UTC
you really don't need to carefully write every step in a process when writing instructions for a computer... in fact i do this all the time if i am debugging, what i'll do is write one line of code to execute it, make sure that everything is as expected during a break, and then stop the code to add the next line... sometimes i'll even skip a line all together and go back later to add it...
dday9
2017-01-10 16:56:59 UTC
You really don't need to carefully write every step in a process when writing instructions for a computer. In fact I do this all the time if I am debugging, what I'll do is write one line of code to execute it, make sure that everything is as expected during a break, and then stop the code to add the next line. Sometimes I'll even skip a line all together and go back later to add it.
ItsMe
2017-01-11 02:20:10 UTC
The simplest way to explain programming is using plumbing... Honestly!!



Programming is the same as designing the water-pipes within a house (or building). You need to know what you want to happen (you want a tap/sink in a bathroom on the 2nd floor). You need to know what type of water you need there (hot and cold or only cold). You need to know that toilets don't need hot-water pipes. You need to know that water pipes run along the outer-walls of a house that's in the northern climates will need insulation (to prevent the water from freezing in winter). So those external pipes need "protection". In software, certain data (and data-paths) are protected, perhaps using encryption or other means.



These are all examples of/considered to be the "requirements" of what the computer program must do. And a software developer/programmer must know that requirements can be written in a vague way -- and how to ask more info if they're given vague instructions. They may also need to understand a bit of physics or engineering (for more complex programming problems)... similar to a plumber having to know that gravity makes water fall/flow "downward"... and thus water pipes need sufficient "water pressure" to make water reach the 10th floor of a building. And if you use a thick pipe to go that high, it needs much greater pressure than a thin pipe going that high. These are knowledge that a plumber (and programmer) need to know... about "physics" of the world.



So using this analogy... when you run a program, all that truly happens is "water" flows through the "pipes"... and they stop at some places (a closed tap/faucet) or they go to different places based on what the programmer did... which pipes were connected where... the thickness of pipes used... if both hot+cold pipes were sent together, or cold-only pipes.... etc.



When you run a program... the "water" automatically moves everywhere -- through the pipes. The programming/coding (that was already done) only makes the water go to one place or another. Or to make the pipes "knock" or freeze in the winter and burst (coding bugs).



In an actual computer, it's not water that's flowing but electricity (a stream of electrons, instead of a stream of H2O molecules). But otherwise they are nearly identical. They both use physics. Water systems use Newtonian physics (simpler), while computers use a more advanced (Quantum) physics.



If you understood this, then you know it's very important for the programmer/plumber to ensure every pipe does connect to the right places, and no pipe is left unconnected (inside a wall) -- otherwise the water will just gush-out of that pipe and flood the building (i.e., crash the computer or operating system) -- in computers, this is euphemistically called a "memory leak" -- a true programming term).



This is why programmers must be very careful when writing a program. They must ensure every "instruction" (pipe) is the correct diameter (can carry the right types of data/bits)... and that instruction will make the data (water) go where it needs to (i.e. that an instruction's/pipe's output goes to/is connected to the input for the next instruction/pipe). If a thin pipe must be connected to a thick pipe, the programmer must use the right "glue code" or "fitting" (casting) to make that connection -- just as in plumbing. Believe it or not, in some operating systems (like Unix and Linux) there is a command called a "pipe".



Computers actually work very similarly to water-systems -- they truly are "electron-movement systems".



Hope this helped.



:)
William
2017-01-10 16:29:44 UTC
Because if there is just one piece of code out of place (or wrong) the entire instruction would not work.
Chris
2017-01-10 17:24:31 UTC
Because the computer cannot think, or improvise, or fill gaps; all it can do is precisely follow every instruction, as literal as possible.
Smilax
2017-01-16 01:47:34 UTC
they don't. they abstract those instructions with procedures, and deal with the details that are important at the levels they're working at.
Andy T
2017-01-11 15:30:10 UTC
Computers are dumb, brain-dead things, that's no joke, that implies slew of things such as what you just asked.
Kyle T
2017-01-11 03:33:10 UTC
one word: segfaults



ok thats actually 2 words, but this is a common c++ error when you arent careful with your code and you try to access memory that doesnt exist
theteam
2017-01-18 13:02:38 UTC
because computer can not think manual steps
2017-01-15 11:16:34 UTC
'cause otherwise it wont work as desired
?
2017-01-10 16:30:22 UTC
because otherwise it wont work as desired


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...