Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Become a Better Programmer by Mastering Google

DZone's Guide to

Become a Better Programmer by Mastering Google

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Modern programming is now often equated to being really good at Google.  If you're trying to achieve something in code, 99% of the time it's likely that someone else has already done it and posted it up on Stack Overflow or Github.  No longer is there a need for a stack of textbooks at a developers desk; instead, we just need to type it into the search box and hope it shows up in the first 9 results.

What a lot of people don't realise is that Google has a lot of powerful tricks hidden up it's sleeve.  As much as we have become obssesed with the power of keyboard shortcuts for speed and agility in coding, there are a selection of commands which can take your Google-fu to the next level.  Here are some of those commands and how they can be best used by a developer.

Exact Phrase Search

If you wrap part or all of your search with quotation marks, Google will search for the exact phrase entered, unlike normal where it searches for the words individually.  This is my most common go-to power function on Google.

As a developer, this can be really useful when searching for exception strings.  You know you want that exact exception without variance, so this can cut out the cruft in the results.

Example

"Failed to parse configuration at: logging.appenders.[0]" mvn assembly plugin

The exact exception text is in the quotations, but I've then thrown in some extra terms that are relevant to help focus.  

Exclude Term

There can be a lot of overlap in our little world of programming. Projects with similar names and overloaded terms can make it very frustrating when combing through search results.  It's really easy to exclude a word from search results though; simply add a "-" before a word.

Example

Spark Java -Apache

Annoyingly in Java there is sparkjava and Apache Spark.  If searching for the former, you can remove all Apache based results with ease.

Related Terms

Want to know what the alternatives are to a technology?  The related keyword has your back.  It expects a URL and will return websites which have a similar content.  In practice, I've found it useful for bringing up alternative technologies or frameworks, or finding things which are additive and compatible.

Example

related:mongodb.org

Image title

We now have a list of similar and alternative NoSQL databases to MongoDB.

FileType

Did you know you can mandate the type of file you want to search for in Google?  This can be really useful when looking for printable cheatsheets as you can specify PDF files, although this can be applicable to a host of searches.

Example

IntelliJ shortcuts filetype:PDF

Image title

Search Within a Site

I often find that the search on a website or forum is terrible.  Fortunately, Google can rescue the situation.  It's possible to specify Google specifically search a site or subdomain.  

Example

intellij shortcuts site:stackoverflow.com

Bonus Feature! Directly Search a Website From Chrome

Chrome has support for custom search engines. This is immensely powerful, particularly if you're always searching on a particular site such as StackOverflow.  


First, right click the address bar and select Edit Search Engines.

Image title

In the box that comes up, scroll to the bottom of "Other Search Engines".  Let's say we want to add support for Stack Overflow. In the first field, we'll put "Stack Overflow" as that's the name of the engine. In the second we need a shortcut; when enabled, we'll type this into the address bar to say that is the engine we want to use.  I'll use "so" for this purpose.  We then need a URL, where we replace the search term with %s. If we do a sample search on StackOverflow and check out the URL we can see where to replace the term with %s:

Image title

We replace my term with %s to give us http://www.stackoverflow.com/search?q=%s. Put this into the third field.  Click done, and your engine is live.

In the address bar, type "so" then space.  Chrome should then tell you you're searching Stack Overflow.Image title

Pop any questions or queries into the comments, or follow me directly on Twitter via @SambaHK.

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:
search ,google ,stack overflow ,productivity

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}