I am a noob when it comes to programming. I just know some Ruby, that's really it when it comes to programming, but it's definitely an interest.
In learning to program, I give myself tasks to complete in order to better learn Ruby but I am finding that a lot of my problems in programming deal with how to execute a task.
For example: In writing a SERP checker (which is, sadly, half complete because I can't read PHP) I found a PHP script of what I was programming. I used it as sort of a template in order to write my checker. (I'm not actually going to use my checker, just a task for me to learn.) Anyway, when I was investigating the PHP I learned that the script does a lot of things I wouldn't expect it to do.
I knew NOTHING about how I was going to get the script to make a Google search, how it was going to collect the data, etc.
How do I learn these things? If I were to make this script from this guy's template, all I would learn is how to make a SERP script. But how did this guy learn how to make the script? What elements to put in/use?
Something a friend found in my script (a bug) that I never even considered was related to differences in Windows vs Linux (I unfortunately have to program in Windows until I partition my hd and slap a linux distro on there. The only reason I have Windows is because the whole Steam on Linux thing was a hoax.) It had to do with newlines, spaces, or something.. I don't remember off the top of my head.
How was I supposed to have the foresight to know about the bug? How would I have caught the bug if my friend who is uber savvy hadn't pointed it out? And really, the most important part of my question is the above part: How do I know what elements* (*if I use the word 'functions' here I worry it would be confused with methods...) I need to put in a program in order to complete a given task?