Coding is knowing how to ask questions *well*
The thinking skill that's often not explicitly taught
I’d been taking a web development course on Udemy and this week I finally started on learning server-side programming. Front-end development had been relatively easier for me to pick up because over the years of setting up Wordpress websites, one invariably comes across HTML, CSS and some Javascript. I realised there had been a lot of accidental immersion and learning in that aspect. But, back-end is completely foreign to me and now it’s feeling really hard.
Nobody teaches how to properly google for answers
One of the main things I never learned though was how to properly google programming questions when I’m stuck. As a beginner, I’m completely unfamiliar with the technical terms of the language, so I end up searching using very broad, vague keywords that doesn’t help much at all. I don’t even know how to phrase my problem properly!
For instance, I was learning how to make a web scraper using PHP. The instructor showed us how to use file_get_contents
function but just to get the whole web page. I wanted to scrape a specific text content from a specific class so just simply using file_get_contents
wouldn’t work . So I simply googled “PHP scrape html class element”. Some useful stuff but still kind of broad. A lot of stuff pointing me to using other libraries. I fiddled around, copy and pasted bits of code I found from Stack Overflow but nothing worked (I later realised I needed to download the libraries, which wasn’t really mentioned in the answers ?).
Later on during the instructor demo, he googled “split a string” and got links to the explode
function, which helps to extract specific parts of the HTML code after you used the file_get_contents
function. Like WTF? How does a beginner even know “split a string” are the right keywords to use?
Not even knowing the right search key words to use
The problem is I don’t even know the right words to use to get to what I need. The right words at the right level of specificity and technicality. Learning the coding ‘vocabulary’ of terms and syntax takes time and as a beginner, that’s my weak spot in being able to find the right answers online.
It felt like I was trying to learn a foreign language, like say French, but only had a German-French dictionary to learn it. If I don’t know German to start with, how do I even find the right word in French? How do I bridge English to German (i.e. rookie search keywords to right technical terms to the right answer)?
Beginner's guide on how to know what key words to use
After doing some reading online and coming across great articles like this one, I learned that it’s like a funnel/spiral, with at least 2 layers of search to slowly zoom in on my answer:
- Do a general, intentionally imperfect search first, to find the right technical terms:
a. Search on community forums where beginners might have phrased the same question in the same way as you would have. Stack Overflow might not be the most useful at this stage yet.
b. Or scroll through support documentation like W3 School or specific ones like PHP.net (these are like the ‘dictionaries’ of programming), where you can read through the definitions of the syntax, and starting collecting the right keywords…
c. Narrow in on a few keywords - the language/framework/library you’re using, a noun to describe the what (e.g. element, selector), a verb to describe an action/task you want to do with something (e.g. event, function)
- Then get more specific and technical on the next layer of search:
a. This time, we can start trying more expert forums like Stack Overflow, or one for your language
b. Type and search away!
Did I miss out anything? Any other useful tips on how to google for the right answer in programming?
Follow my daily writings on Lifelog, where I write about learning to code, goals, productivity, indie hacking and tech for good.