Google Code Search

A few months ago, I posted about searching for code. I just learned that Google made an announcement last week about Google Code Search.

I tried it out, but I didn’t find too much more than other code search engines. I was expecting something more, especially in the advanced search section. You can search by license, for instance, but how hard would it be to list compatible licenses, too? For instance, if I look up code under the GPL, wouldn’t it be rather simple to also list similarly licensed code?

I tried looking for a piece of code that I tried to find a few weeks ago. I just wanted to use a Point class to represent a two-dimensional position in space. I figured it would be trivial to write myself, but it would probably be even simpler and less error-prone to find someone else’s well-tested implementation. I actually found that Google’s code search wasn’t returning results as well as other search engines. It was finding all sorts of code that happened to have the word “point” in it.

On the other hand, the engine does support regex, which is really nice. I don’t know how many times I have wanted to search for something with:

 #include\ "sd[a-z]*.h" 

Typing the above actually shows you the source to SDL_image.h, specifically as part of the framework source for the Weird Worlds demo, interestingly enough. Small world, eh?

And of course, being the vain Internet user I am, I decided to do a search for my name. The search engine actually returned results that included the source to a number of my projects! I guess Google does a really good job of crawling websites.

2 comments to Google Code Search

  • Sweet it has the source for FucMan! I could also find my Swarm game with “Swarm ludumdare” (interestingly enough mine is the ONLY entry that came up from the competition…) Too bad I can’t find some of my older games like Guardian X and Crisis Team that are RIP on my old HD :(.

    Also if you want a point class search for “Point2D” or “Vector2D” you’ll find 1000 versions of the same code :).

  • Heh, good point. I didn’t spend too much time searching, though, so maybe if I stuck with it as if I was really trying to find such code, it wouldn’t be so bad. Then again, the reviews I’ve seen so far also found that other code search engines are either the same or better. Hopefully the algorithms improve to make it much more useful than simply being part of Google.

Twitter: gbgames