How to Use Google to Solve Your Programming Questions

How to Use Google to Solve Your Programming Questions

10 min read

For the last >150 days since I started my Youtube channel, I have released a new video every single day (although sometimes after midnight). And since I learn the programming concepts I teach there in the process of making these videos, this also means that I had to research extensively about a topic more than 150 times. And for the most part I am happy with the results. I understand most of the content enough to confidently explain it, and I am also able to spot some errors and redundancy in the examples I find online. I definitely make mistakes, but I also only talk about a topic when I feel like I understand it properly. I try not to copy any mistakes just because they are made over and over again and if anything is not clear, I want to know exactly what is going on there.

A lot of viewers asked me in the YouTube comments about my research process and that’s what I want to talk about in this blog post. I want to talk about how exactly I use Google to find what I am looking for and how I remove any ambiguity that I have left about a topic. Because it’s actually not as easy as it seems and it’s definitely not as simple as just typing the topic into the search box.

Below are the steps and techniques that I use, but of course I am no Google-search specialist and there are other methods and features to improve search results further that I don’t use at all (like wild cards). So don’t limit yourself to the tips listed here. Also this list is in no particular order (except for the general overview at #1).

 

Getting a general overview

When I learn about a new concept in Android, I begin by acquiring a general idea of the topic. I start with a search for Android [topic] and Android [topic] tutorial. Usually the Android documentation and training pages are somewhere at the top and I make sure to visit them and read the interesting parts. Then I read a couple of blog posts and tutorials. Medium blog posts often have a higher quality, so I prefer them, but of course there are other good sources as well (and not all Medium blog posts are good either). Unfortunately, most Youtube tutorials are too slow for my taste and often hard to understand, so I barely watch those. And when I do, I set the speed to 2x and try to get through them as quickly as possible.  Of course that doesn’t mean you should stop watching my videos, because I make them so that I would watch them myself.

I really try to read a lot of blog posts and pages rather then digging too deeply into one source. This way I get a good overview and see many different approaches from different developers. With time you get a feeling for what sources are the more reliable ones and which ones you better avoid. The first part of my research process is just about getting a general idea. What is this whole thing about? What do people use it for? What differences can I see in different code examples? Are there common problems or questions that come up regularly or have there been any recent changes?

 

Narrowing the time span

Android development is advancing very quickly and things get outdated and deprecated rather fast. Sometimes I spent hours researching about something and was almost ready to make a video to summarize it, just to find out in the last minute that the whole implementation changed and my approach is useless now. To avoid this I usually make another Google search where I set the time span to “last year” in the “Tools” menu under the search box. This gives me the search results for the last 365 days which is quite up to date. If there are too few results, I increase it to 2 or 3 years (for this you have to set a custom time span).

I skip this step when I research about core java concepts or really basic Android stuff like how to use SQLite in an app. But if I have the slightest feeling that whatever I am searching for could be prone to changes, I make sure to filter for up to date results. If you have a suspicion that there could’ve been changes very recently, then you can even go as low as the last month (last week would probably be a bit too much).

 

Using quotation marks to search for specific phrases

When I dive deeper into a topic, I start to get a better idea about different aspects of it and can make more specific searches. For this I use quotation marks (” “) extensively. When you put them around text, it will search for that exact phrase. Otherwise it will just use your words to make a guess. If you search for Coding in Flow without quotation marks, it will give you a lot of results that contain either “coding” or “flow” and even results for related words like “programming”. For most topics this works pretty well, but sometimes you need search results for a very specific phrase and then you should add quotation marks. Here you can get very creative about combinations.

Let’s say for example you want to use SharedPreferences and you are not sure about the proper naming convention for the key constants that you have to pass when you want to save a value. If you search for SharedPreferences key constant naming convention you will probably have very poor results, because this is a very specific topic about which there are usually no articles or blog posts. But you know that we declare constants in java with “static final” and that the key is a string value. So you can search for SharedPreferences “static final String” and you will find a lot of examples for constant names for SharedPreferences, because “static final String” on the same page that talks about SharedPreferences has a high chance of being a constant for it. Now these sites probably don’t discuss the proper naming convention in detail, but they contain the information you want. When you are on one of these pages, hit Ctrl + F to open the search box and then type in the same phrase as you put between the quotation marks. Jump through the results to see if anything helps you with your question.

Of course this will also show bad and wrong examples, so keep that in mind and filter your results. When I search like this, I usually compare a lot of different approaches to get an idea and then I try to estimate which are the more reliable ones. If a Stackoverflow user with a high rating used a certain naming convention in his post, then I give it more credit than a post on a random page. 

Use quotation marks for text and code snippets that are somewhat “unique” to what you are searching for. But don’t include anything that you had to name yourself. Don’t search for SharedPreferences “static final String KEY_NAME” when “KEY_NAME” is the variable name you choose, because then you only find results where someone coincidentally picked the exact same variable name. 

I also use quotation marks to search for phrases that could help me understand something better if they appear in the text 1:1. For example when I researched about the Palette class in Android, I wanted to know if I understood it correctly, that the Palette extracts the 16 most prominent colors from an image, or if there are other criteria for how it picks it’s colors. So instead of just going through all the posts and hoping that I find something that answers my question, I searched for Android Palette “prominent colors” and I found a lot of great results that clarified my question, because they contained “prominent colors” as an exact phrase in their text. Then I just had to hit Ctrl + F to start a page search and jump directly to those paragraphs.

You can also use quotation marks around a single word to force it into the search and this way avoid getting results that do not contain it. Try to get creative about the quotation mark combinations. They can really help you if you use them correctly.

 

Excluding words with “-“

Another helpful Google feature is the possibility to exclude words from the search by putting a minus (-) in front of them. Let’s say for example you want to learn about the Volley library. A common way to use Volley is in the form of a Singleton class. This is not the easiest thing to understand and as a newbie you might want to know how to do it without that weird Singleton thing first, as it was the case for me. But annoyingly almost all of the search results use this Singleton implementation. What you can do in this case, is to search for Android Volley tutorial -Singleton and you won’t get any results that contain the word “Singleton”. That’s a really nice way to narrow your search and find what you want. But be careful with excluding words, because it means that they are not allowed to appear on that page at all, even if it’s not related to the thing you are searching for. 

You can also use this technique to exclude whole websites. Maybe you don’t want any result from Stackoverflow, because you just want to see articles and blog posts. Or sometimes your search results are spammed with a lot of links to 1 particular website that you don’t want to see, then you can exclude those as well. 

 

Using image search with a specific picture in mind

Using the Google image search for programming questions is not the most obvious technique, but it can be helpful as well. Sometimes you can identify what you are looking for better by seeing it as a screenshot.

Let’s say you want to learn how to create your own custom AlertDialog. There are a lot of posts and tutorials about this, but the way of execution can be quite different. Some might show you how to build a dialog with only text in it, but maybe you want to know how to implement a button into the layout. Or you want to know how to change the color of specific parts of the dialog. Instead of using a vague text search and then hoping that you stumble upon the right tutorial, you can run an image search and see directly which result you will get (if they provide an image, which they mostly do). Find an image that looks right and then visit it’s web page to find the text it was used in. This way you might also find things that you don’t know the exact name of. 

 

Ok, these are the techniques I use to find what I am looking for. Of course you can (and should) combine them to improve your results even further.

How do you use Google? If you have any helpful tips that I don’t know about, let me know in the comments. And if you know someone that could find this helpful, you can share this post with the buttons below. This way you also support my project and do me a big favor 🙂 Every bit helps. Take care!

2 thoughts on “How to Use Google to Solve Your Programming Questions

  1. Hi flow ,

    nice tipps for the google search engine.

    Video learning is my first goto ressource . (Courses provided for free by google on udacity.com). They explain every single line of code & even open up the documentation for you :D.

    Instead of playing any games in my free time , I like to lean back & watch courses at my leisure 😀 …

    Though on weekends I take breaks from learning , so I can stay motivated.
    Not overdoing it is very important 😉 .

  2. Nice Article Sir,

    Good Information. I am glad you share your valuable experience with new comers like us. Keep going sir. I find your tutorial best after searching and trying out so many tutorial.

Leave a Comment