The complex and often murky waters of web and software development just became a little clearer, thanks to a recent new search feature that Bing has added to its search engine. The relevant code snippet will display directly in the search results under the page link as a “Code sample”. This snippet can eliminate the need to scroll through an entire page of verbiage to get to the relevant information.
The typical code search process
We have all been there. When there is a knotty problem we are trying to solve in any particular code application, we know there is no existing book that will answer this question. Our only recourse is to surf the Internet for answers given to other fellow questors. We optimistically enter our query into a search engine and hope for the best. After hours spent researching, we are often no closer to a workable solution.
Part of the problem is that there are many different programming languages. Even if we search with a specific language in our query, the answer more often than not, will not be tagged as being in that particular language. We may have to scroll through the whole page of questions and examples to see if one of the answers is in the syntax we need.
To produce these types of search results, Bing combines natural language processing and language agnostic code understanding to provide a Code sample answer. The process involves intelligent analysis of the search term as a whole, rather than just matching keywords. To achieve this level of probability, Bing analyses patterns from developer query training data that contains common terms and language structure in programming queries. These Code samples will only trigger when Bing determines its interpretation of the coding request as highly probable.
While it is not likely that an exact solution will always appear instantly for every programming question query, this does narrow down the search a bit and often does produce information that is relevant. For instance, if searching for “SQLite parameterised query”, we would find a Code sample with a code snippet including a Parameters.AddWithValue(“$name”, name) parameter and a procedural call using ExecuteNonQuery(), which is useful for several languages and databases.
Time is money and money is time. Anything that lessens the time spent searching fruitlessly for answers to our work-related questions is a good thing. Thank you, Bing.