Duck's Blog

How to Google?

Author: Duck

09.04.2021

How to Google?

Hello! You were referred to this page because you had a question that could be solved by a Google search within seconds. Or maybe not, but it is quite important that you google your problems before asking someone.

No developer knows everything and sometimes you forget certain things if you don’t use them often. That’s not a problem, because you can find most of it again on the internet. Most of your questions have already been answered at least once online, because you are definitely not the only one with this particular question. Additionally, each programming language, API or program should be well documented in an official documentation. It’s a valuable source of information about the documented product, as I describe in my post "How to ask a question?" .

Knowing how to successfully google something is an important skill for every developer. But how do you google correctly and what does that mean?

Phrase your question

You should keep in mind that a search engine will search the web using the terms you specify. Try to provide as much information as necessary, but also try to keep it short at the same time. Sometimes you don’t even need to formulate the entire question. Specifying the most important keywords is usually enough to get the desired results, especially for simpler things. Also important to consider is that most of the people use simple terms to describe their problems online. So should you. Sometimes the terms you need to search for are much simpler than you think.

What should your google search include?

Alright, that’s fine. But what do you have to include?
I’ll be talking specifically about programming languages, game engines, and other development tools in general, but this is applicable to other areas until a certain degree as well. There are a few things you need to consider:

  • Include the name of the tool your question is about!

  • Involve your problem/question with keywords!

  • Preferably formulate your question/the terms in English.

This is the preferred structure of your search request:

Examples

Let’s make some examples using the Unity game engine, the C# programming language and the professional IDE Visual Studio:

“How do I convert a string to an int in C#?”

“How do I detect when two objects collide with each other in Unity?”

“My IntelliSense in Visual Studio Community 2019 doesn’t work properly anymore. How do I get it to work like it did before?”

You can definitely spot a pattern here. And that’s basically all the magic. We could dig deeper into the topic and take a look at more specific problems.

Special cases

There are some exceptions (not the exceptions in the programming sense), which work very similarly to the initial preferred query structure, but there are slight differences. I’ll cover one of them with big importance…

Errors

Assuming you got an error message, you don’t necessarily need to use the exact same pattern as usually. From the error message you can get a quick description of the problem and this should already be enough for you to be able to solve the error. If you can’t, the least it gives you is a term you can google. Moreover, you can usually see which line this error originates from in your IDE/code editor. This helps you to find the problem, so you can try to solve it yourself first.
If you decide to ask Google for help, you can generally follow two patterns:

  • you can either paste the entire error (without file names, lines, columns and other irrelevant stuff, like the term “error” or the error code)

  • or filter the most important part from the error message and only use this term

Either way, you’d want to follow the same template:

The error is the most important part. This is what will make up your entire set of results. Let’s learn from a few examples…

Examples

Error: CS0029: Cannot implicitly convert type 'int' to 'string'

From the error message, we can see that we’re trying to assign an integer to a string type. These are two different types, which are not implicitly convertible into each other. Let’s google it by using the entire error without irrelevant terms like “Error:” and even the error code, being CS0029 in this example.

VoilĂ , I got about 904'000 results with exactly these terms!

904'000 results

Let us cover an example, where we’ll only pick the important terms from the error message.

NullReferenceException: Object reference not set to an instance of an object
Example.Start() (at Assets/Scripts/Example.cs:12)

We can clearly see the exception type. It’s a NullReferenceException. The rest of the first part is just additional information about this type of exception. On the next line, you can see the stack trace of this exception. In this case, this exception originates from line 12 inside the Start() method in the Example.cs file.
We will only pick the most important part of this exception, which is of course the exception type. Google doesn’t need to know the path and name of the file whose code caused this exception, because the name doesn’t change the error, it’s a term varying for every individual line of code and file. The search engine doesn’t care whether your file is called LevelManager.cs or Parser.cs. Including that can only lead to less results than without that. Try to keep it general!

Yes indeed, this is enough to get about 205'000 results.

205'000 results

The number of results you get differs according to the language, region, search terms and possibly other influences.

Closing words

We’re slowly approaching the end of this blog post. To finish this up, I’d like to give you some final tips. (Un)fortunately, search engines can’t read your mind. They search using the terms you type in. If you can’t find the desired results at first, try using slightly different keywords. It may require some effort to find what you want, which usually pays off in the end. Searching things up will become more and more of a routine task as time passes.

Soon, you can call yourself an expert in terms of researching your problems and questions.