Microsoft has updated its Bing Developer Assistant Beta, a Visual Studio 2013 add-in which hooks into IntelliSense so that you get code samples as well as brief documentation. For example, in an Entity Framework project, if you select dbContext.SaveChanges, you get a code sample which uses that method.
There is no guarantee of course that the sample is relevant to what you are trying to accomplish. You can hit Search More though and get a selection of code snippets and sample projects, drawn from sites including MSDN, StackOverflow and Codeproject.
Developer beware though. Looking at the code samples, the top one is from a 2011 blog post relating to CTP (Community Tech Preview) 5 of Entity Framework 4.1. If you hit the link, you get this:
“The information in this post is out of date”, it says, followed by a link to what is in fairness a rather helpful article on using SaveChanges.
Hmm, maybe Bing Developer Assistant should try filtering the search to eliminate samples on preview or obsolete APIs? A snag here though is that on occasion the blogs and samples on preview frameworks are all you can get, because by the time the thing is actually released, the developer evangelists have move on to blog about the next up and coming cool thing.
If you choose an object member for which Bing finds no code sample, you are prompted to add one of your own:
This takes to to the Developer Network sample upload page:
This form is quite a lot of work, but lets you add a code snippet or sample project together with title and comments explaining what it does.
The Bing Developer Assistant also searches for sample projects:
Again it is a case of picking and choosing what is really relevant; but developers are experts and expected to use common sense.
A drawback with Bing Developer Assistant is that only one add-on can extend IntelliSense, so if you use Resharper or another tool which also does this, you have to choose which one to allow.
In the end, this is all about integrating web search into the IDE. Is that a good idea, or is it better simply to have your web browser open, perhaps on another display, and type “dbContext SaveChanges EF6” or some such into your favourite search engine?
There is some merit in a search engine that automatically filters to show only code samples – hey, that is what Google’s popular Code Search did, until it was mysteriously shut down – though I’m not sure how much I like the idea of possibly obsolete and deprecated samples showing up in Visual Studio as you are coding.
Still, the truth is that web search is critical to software development today and it is good to see that recognised.
- Visual Studio Code: an official Microsoft IDE for Mac, Windows, Linux
- Mono Tools for Visual Studio: code on Windows, run on Linux
- Code for Mac Cocoa in Visual Studio – surprised to see this?
- Xamarin 3.0 brings iOS visual design to Visual Studio, cross-platform XAML, F#, NuGet and more
- Fixing Visual Basic for Applications code for 64-bit Microsoft Office