Searching for Code Online
While drinking my much improved coffee this morning and doing my rounds through my RSS feeds, I happened about a Slashdot post about Google offering a new "code search". It's interesting stuff--especially how the FAQ mentions that they can't guarantee that the code that they are returning to you is actually under the license they label it as, so it's risky business to actually use any of the code that you might find on there, and definitely isn't appropriate for developers to use to find code snippets or other code blocks that they might want to tie back into their apps.
Our team has been thinking about power toys or any other ways that we could help developers, especially new developers to the Microsoft platform, more readily find code snippets and sample applications that apply to what they are working on. Searching through code just based on regular expressions and the like might be good if you wanted to find a code sample of how you use a particular API or library, but it seems lousy for the situations where you want an example of how to *do* something (such as our classic example we use on the forums all the time..."How do I find the difference between two DateTimes in C#?") Not to mention that regexes aren't super-accessible for new developers who are just starting to code for the first time... :)
The other flaw is that the only way people could contribute and get added to these search results is to have a project in some publicly accessible source control--this really isn't a "sharing code" site...it's a "grabbing code anonymously" engine.
What do you think? What would be the ideal way you would want to find code samples and snippets on the Internet?