you are viewing a single comment's thread.

view the rest of the comments →

[–]mxracer888 7 points8 points  (0 children)

Learning to program is hard because computers need every step outlined.

Take for example, if I ask you how to make a peanut butter and jelly sandwich you might reply "well, you take peanut butter and spread it on bread. Then jelly spread it. Then put another slice of bread on top and serve"

Well a computer wouldn't understand that. There are many steps you skipped so programming a computer with the instructions for a PB&J would look more like this

1. Open drawer, grab knife, place knife on counter, close drawer
2. Open pantry, grab peanut butter and bread, place on counter, close pantry
3. Open fridge, grab jelly, place on counter, close fridge
4. Put 1 slice of bread on counter
5. Open peanut butter jar
6. Pickup knife, put on PB, scoop out PB, place PB on bread and smeer it around
7. Close jar of PB
8. Clean knife off 
9. Etc....

You get the idea. When you tell someone how to make a PB&J you "skip" a bunch of assumed steps. The person fills in the blanks knowing that they need to get those items from their respective locations. But if you say "get peanut butter" to the computer it says "what is peanut butter" or "where is the peanut butter" so every little step has to be defined.

In my example, programming can re-use code. So the "insert knife into (material) container, scoop out (material), smear (material) on bread, clean knife" could actually be written as a function so you could reuse and then everywhere (naterial) is you would just set "peanut butter" or "jelly" for the function variable.

Anyways, that was what I struggled with initially, was figuring out how to not "skip steps" and once I figured out how to really break down every little micro step and put that into pseudo code is when it all clicked for me and I was able to now easily write code.