Googling for code solutions can be tricky — here's how to get started

Mad Libs was driving me mad.

In order to learn JavaScript earlier this quarter, I set out to build a web application that would mimic a game of Mad Libs and immediately got stuck. The idea was that the game would prompt you to enter a set of random words according to specific parts of speech, and then return to you a story whose blanks had been filled in with those words. Cue a hilarious mix match of sentences.

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.”

Often, especially for an inexperienced coder like me, the trouble with tackling projects with an infinite number of methods (as with JavaScript) is that you don’t necessarily know what the language can or can’t do. So you just have to cross your fingers and hope that Google will fetch the answer to the annoyingly contextual problem you have before you can even articulate what specific action you want the code to carry out.

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:

Half an hour later, Timothy Kempf, a developer in California, took kindly to my tweet of desperation and asked what kind of problems I was having. After going back and forth on Twitter, he offered to look over a Gist (Warning: Code may make your eyes bleed) of my code, and left comments for how I could fix it. I had my Eureka moment then. I was telling the JavaScript to run as soon as the document loaded, not necessarily within the workflow of my submit button, which rendered it unusable. My immediate problem was solved, but I knew I couldn’t always rely on a real, experienced developer to look over my shoddy code every time it didn't work. So instead, I took a step back and asked myself: How do the pros do it? I asked Jeremy Bowers, a news applications developer at NPR, who said he follows a specific pattern when Googling to achieve specific outcomes:

e.g. “JavaScript remove key from object”

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:

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.”

Lucky for us, Google has a tutorial on how to use the console for debugging JavaScript, which, I’m sure, you can apply to other languages.

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.

About the author

Suyeon Son

Undergraduate Fellow

Latest Posts

  • Building a Community for VR and AR Storytelling

    In 2016 we founded the Device Lab to provide a hub for the exploration of AR/VR storytelling on campus. In addition to providing access to these technologies for Medill and the wider Northwestern community, we’ve also pursued a wide variety of research and experimental content development projects. We’ve built WebVR timelines of feminist history and looked into the inner workings of ambisonic audio. We’ve built virtual coral reefs and prototyped an AR experience setting interviews...

    Continue Reading

  • A Brief Introduction to NewsgamesCan video games be used to tell the news?

    When the Financial Times released The Uber Game in 2017, the game immediately gained widespread popularity with more than 360,000 visits, rising up the ranks as the paper’s most popular interactive piece of the year. David Blood, the game’s lead developer, said that the average time spent on the page was about 20 minutes, which was substantially longer than what most Financial Times interactives tend to receive, according to Blood. The Uber Game was so successful that the Financial...

    Continue Reading

  • With the 25th CAR Conference upon us, let’s recall the first oneWhen the Web was young, data journalism pioneers gathered in Raleigh

    For a few days in October 1993, if you were interested in journalism and technology, Raleigh, North Carolina was the place you had to be. The first Computer-Assisted Reporting Conference offered by Investigative Reporters & Editors brought more than 400 journalists to Raleigh for 3½ days of panels, demos and hands-on lessons in how to use computers to find stories in data. That seminal event will be commemorated this week at the 25th CAR Conference, which...

    Continue Reading

  • Prototyping Augmented Reality

    Something that really frustrates me is that, while I’m excited about the potential AR has for storytelling, I don’t feel like I have really great AR experiences that I can point people to. We know that AR is great for taking a selfie with a Pikachu and it’s pretty good at measuring spaces (as long as your room is really well lit and your phone is fully charged) but beyond that, we’re really still figuring...

    Continue Reading

  • Capturing the Soundfield: Recording Ambisonics for VR

    When building experiences in virtual reality we’re confronted with the challenge of mimicking how sounds hit us in the real world from all directions. One useful tool for us to attempt this mimicry is called a soundfield microphone. We tested one of these microphones to explore how audio plays into building immersive experiences for virtual reality. Approaching ambisonics with the soundfield microphone has become popular in development for VR particularly for 360 videos. With it,...

    Continue Reading

  • Audience Engagement and Onboarding with Hearken Auditing the News Resurrecting History for VR Civic Engagement with City Bureau Automated Fact Checking Conversational Interface for News Creative Co-Author Crowdsourcing for Journalism Environmental Reporting with Sensors Augmented Reality Visualizations Exploring Data Visualization in VR Fact Flow Storytelling with GIFs Historical Census Data Information Spaces in AR/VR Contrasting Forms Of Interactive 3D Storytelling Interactive Audio Juxtapose Legislator Tracker Storytelling with Augmented Reality Music Magazine Navigating Virtual Reality Open Data Reporter Oscillations Personalize My Story Photo Bingo Photojournalism in 3D for VR and Beyond Podcast Discoverability Privacy Mirror Projection Mapping ProPublica Illinois Rethinking Election Coverage SensorGrid API and Dashboard Sidebar Smarter News Exploring Software Defined Radio Story for You Storyline: Charts that tell stories. Storytelling Layers on 360 Video Talking to Data Visual Recipes Watch Me Work Writing and Designing for Chatbots
  • Prototyping Spatial Audio for Movement Art

    One of Oscillations’ technical goals for this quarter’s Knight Lab Studio class was an exploration of spatial audio. Spatial audio is sound that exists in three dimensions. It is a perfect complement to 360 video, because sound sources can be localized to certain parts of the video. Oscillations is especially interested in using spatial audio to enhance the neuroscientific principles of audiovisual synchrony that they aim to emphasize in their productions. Existing work in spatial......

    Continue Reading

Storytelling Tools

We build easy-to-use tools that can help you tell better stories.

View More