Mad Libs was driving me mad.
In theory, building it would be simple: have an input form in which the user entered various words. With a button click, my code would hide the form, and show the story template with its blanks populated with the input values.
But none of it was working. I needed my code to rewrite the HTML with the resulting story, but It. Just. Wouldn’t. Do it.
Unfortunately, you can’t Google “my Mad Libs project isn’t working,” or even, “rewrite HTML with resulting story like in Mad Libs.”
For my MadLibs project, no permutation or combination of the words “input values into text,” “populate template,” “rewrite HTML” was giving me the answer I wanted, so I took to Twitter:
I’m seriously lacking in the department of how to Google code problems using the right verbiage
— Suyeon (Summer) Son (@suyeon_son) January 26, 2014
<programming language> <verb> <specific keywords>
What a deceivingly simple pattern. Like code, which I’ve learned is better simple than complex, Google searches should be simple, but broad enough to bring you the anticipated results. Sadly, my problem was that I didn’t even know how to get to the level of correct specificity.
I next turned to Nick Bennett, a Chicago-based developer, who suggested that I “search to find better search terms.” I myself had been doing this, but failed to recognize the pattern in my habits:
@suyeon_son I go from the general to the specific, and find words in imperfect results I can use to refine/pivot my search. verbose helps.
— Nick Bennett (@yoyoohrho) March 5, 2014
Mine the diamonds in the rough, Bennett said. “There’s nothing wrong with going to page 10+ of search results.”
Alternatively (and perhaps additionally), Kempf suggested you check the console. (For new coders, that’s the box that pops up when you right click + “Inspect Element” in Google Chrome.)
“Odds are, if what you’re doing isn’t working, it’s thrown an error somewhere,” he said. “If you’re having trouble finding out where something is mysteriously dying, you might want to start logging things until you can track down the issue.”
The great thing about the console is that it shoots you an error message that you can also Google.
When all else fails, learn the vocabulary, Kempf said. That might mean an extra 20 minutes on a sidetrack perusing the documentation and perhaps shaving a yak. But ideally, it’ll help you recall other things you’ve heard or read and eventually help refine your searches earlier.
“If you see an error, don’t just fix it,” he said. “While you might be able to solve a problem by copying and pasting from Stack Overflow, the best way to use it is to understand why the problem happened, and how the solution works.”
Of course, if that Gist was any hint, my code had a couple dozen more problems to address. For longer than I’d like to admit, I ran line by line, figuring out each Google query and error message as I went. I rephrased my questions as I picked up new lingo, following Bennett’s advice of using my search results to come up with better search terms. When an error message popped up, I did my best to understand why my code hated me, and how I could fix our tumultuous relationship.
I eventually did finish my Mad Libs project, which helps you come up with a ridiculous excuse for not going into work. It may come in handy, especially the next time I spend too long trying to figure out how to Google when I don’t know what to Google.