Hardly any code is able to run perfectly on its first try. When developers hit Run, programs may encounter compiler errors, runtime errors or unexpected outputs.
There are a few options available at that point. Experienced developers may have seen a similar problem before and remember how to fix it, or another developer on the team may recognize the problem and be able to offer a hand.
But, more often than not, whether it’s because the problem is particularly thorny or there’s no one around who can help, developers have to fall back on another skill — their Google-fu.
4 Ways to Level Up Your Google-Fu
- Don’t trust every answer you find.
- Pinpoint what question you’re really trying to ask.
- Be precise with your terminology.
- Aim for higher-level understanding.
What Is Google-Fu?
The ability to successfully query search engines can hardly seem like a skill, but in practice, learning and finding solutions to technical problems online is important and doesn’t come easily to everyone. Software developers sometimes refer to this skill as “Google-fu.”
Google-fu is not only about knowing which keywords to type into a search bar — developers must be able to navigate an entire search process successfully in order to find answers. That often involves performing a series of tangential searches that gets them incrementally closer to the solution, while simultaneously knowing how to avoid queries that would only distract from their original question.
The goal is to strike a balance between understanding and efficiency. Developers should be able to quickly zero in on the answer and not spend all day getting lost online. This means they need to be able to quickly determine whether a website or resource has useful information, and also be able to arrive at a solution to their problem through it or use it to further inform their next search.
So while typing a few words into a search bar and hitting Enter may not seem like much of a skill, developers’ ability to bend search engine results to their will is undeniably important to their work.
Some are great at it and can find answers quickly and easily. Others hardly ever have any luck, spending countless hours chasing down internet leads without ever getting to the right answer. Although search engines are admittedly doing most of the work, developers’ varied success rates are due to their using different techniques — when to search, what to search and how to search.
Here’s what you can learn from a few Google-fu experts on how to improve your own technique.
Don’t Trust Every Answer You Find
The easiest search to do when encountering a coding error is by querying the error message provided by the compiler. Usually, that’s a good place to start.
“I actually always start by copying and pasting error messages,” said Dan Hales, software developer at ASR Analytics. “It’s a good way to find other people asking about exactly that same error message.”
Though Hales recommends cleaning up the error message before searching on it because messages may contain references to the developer’s code — such as file names — that are not universal and could throw off search results. Instead of copying the entire text of the error message, which can be hundreds of lines long, developers should trim the message and search on important phrases, such as the name of the exception.
“There’s no substitute for experience and knowledge.”
Sometimes this technique can lead to the answer right away, especially if it’s a common problem that people have already seen and encountered before. But blindly copying over error messages into a search query won’t solve every problem — and if developers aren’t careful, it can even lead them astray.
Tim Maliyil, CEO of security company AlertBoot, said the power of search engines also is their downside — anyone can post an answer, even if they don’t know what they’re talking about.
“You need to have a basic understanding of how things work to decipher if an answer makes sense, or if it’s just, you know, garbage — inefficient or just [offering] bad solutions,” Maliyil said. “There’s no substitute for experience and knowledge.”
Answers could be simply outdated as well, said Austyn Tomasik, senior software engineer at Focused Labs.
Sometimes a solution looks like a good idea, “Then you’re like, ‘Oh, this is actually six years old,’” Tomasik said. “Or they didn’t mention the version that they’re working on, and whatever they’re referencing doesn’t exist in your version. You just have to make sure you’re looking at [that] and not wasting time.”
Pinpoint What Question You’re Really Trying to Ask
Developer forum websites like Stack Overflow have some measures in place to prevent people from disseminating bad advice, such as community voting that elevates the best responses. But those methods are less effective for specialized questions, which are read and voted on less often. Developers still need to rely on their ability to ask precise questions and hone their search based on the relevance of responses.
Hale said unsuccessful searches sometimes result from developers rushing to find a fix before understanding the scope of the problem.
“A lot of people Google because they’re trying to find a solution to their problem — but they don’t really know what question they have,” he said. “Before you start typing stuff into Google, if you know exactly what you’re expecting and what should be happening, that can combine with the error message to really narrow down your results to something more useful.”
“A lot of people Google because they’re trying to find a solution to their problem — but they don’t really know what question they have.”
Using debugging tools and printing values to the console during program execution are good ways to pinpoint where errors are coming from. When Hale runs into particularly tricky problems, he dumps a lot of information into the console, looking for the section of code that’s causing the error.
Creating a minimal, reproducible code snippet that can replicate the problem is another good way to isolate the issue, Hale said. This practice helps developers focus on one error at a time and not have to worry about cross-contamination from other parts of the codebase. Ultimately, understanding the code as much as possible will help developers form better searches.
“It’s not something where there’s a quick and easy fix — you really just have to know the ins and outs of the piece of code that you’re working with, and what your codebase is supposed to do,” Hales said. “There’s not really a good substitute for that, unfortunately.”
Be Precise With Your Terminology
For Kristin Jackvony, principal engineer for quality at Paylocity, a successful search is all about finding the right terms to query. That’s because the correct term will link to important resources like library documentation or forum discussions where someone already asked a similar issue. Incorrect terms will instead yield irrelevant results. Getting to the right terminology is a process of refining your search words until you find applicable information.
“Usually I do three- or four-word phrases, usually no more than that,” Jackvony said. “And then I would fine-tune by changing one of the words. Sometimes even just changing one word might be enough to get you a different result.”
Jackvony shared her experience refining a search regarding authentication issues — a notoriously challenging area. While trying to figure out why her browser-side code wasn’t working properly, she started by searching the phrase, “authentication at browser level.”
But that phrase yielded results that were too broad, and Jackvony realized she needed to focus specifically on how tokens are stored in the browser. She changed the search term to focus on “cookies,” and how to save the authentication token as a cookie on the browser. That change proved to be important — and set her on the right path.
“Sometimes even just changing one word might be enough to get you a different result.”
“When I’m starting to see some of the answers I might get better ideas of what words to use,” Jackvony said. “When I first did my search, I was talking about tokens, and then I saw people were talking about cookies. I thought, ‘Oh, what I really need is a cookie.’ So then I’d go back to my original query and then change my word ‘token’ to ‘cookie.’”
Other people can be great resources for finding the right search terms. Even if they don’t know how to solve your problem, they might know the correct technical phrase that can better refine your search. As a software tester, Jackvony isn’t as familiar with certain software terminology as developers are. She finds that developers are often able to produce the right term very quickly when she describes what she’s looking for.
Jackvony also recommends rubber-ducking — talking through the problem out loud to yourself in order to force details to the surface.
“Sometimes just stating the problem out loud, or in writing to somebody, helps sort of jog your brain,” Jackvony said. “Then you suddenly realize that you’re either trying to solve the wrong problem, or you remember how you solved it last time.”
Aim for Higher-Level Understanding
Though forums are useful and can clear up common issues quickly, developers shouldn’t only rely on those sites to solve their problems.
Tomasik from Focused Labs said that, while Stack Overflow is still dominant, she’s noticed blogs and tutorials are better resources for certain types of problems.
“If you’re looking at things that are very specific, sometimes you can find someone who’s encountered it and they wrote it up in a blog post,” she said.
Formal documentation is also a great resource, and is often provided by the company that created the tool or library. Hales recommends looking at the inputs and outputs corresponding to library functions because unexpected program outputs can often be traced back to error outputs from library functions. For instance, the developer may expect a function to return an object, but due to an error it returns a null.
“If I’m not getting that object, it must be something within this method because it was supposed to return that object to me,” he said.
Jackvony recommended going to developer sites or Wikipedia to read generally about unknown terms while refining a search. Helpful information can be found on company blogs, formal documentation or other developers’ blogs. Developers who gain a deeper understanding of the technical principles are able to conduct better searches.
“Sometimes you don’t know something, and you are so new to it that you don’t even know what you don’t know,” Jackvony said. “That’s the time where you stop and you say, ‘OK, let me go back to what problem I am trying to solve. And is this path I’m on leading me toward that solution?’”