Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Microsoft Programming

Bing Now Provides Exact Snippets of Code for Developers' Queries (searchenginejournal.com) 84

"Bing has launched a new intelligent search feature which provides the exact piece of code a developer is looking for," writes Search Engine Journal. An anonymous reader quotes their report: The code snippet will appear right on the search results page itself, which means users will not have to skim through long threads and articles to find the one thing they're looking for. Bing calls this new feature a "Code Sample Answer" and says it's designed to help save developers' time. "Many of us are developers too, and we thought: what if Bing were intelligent enough to do this for us? What if it could save users' time by automatically finding the exact piece of code containing the answer to the question? That is how Code Sample Answer was born..."

A Code Sample Answer will trigger only when Bing intelligently detects the coding intent with high confidence. "To achieve this level of precision for query intent detection, Bing's natural language processing pipelines for developers leverages patterns found in training data from developer queries collected over the years containing commonly used terms and text structure typical for coding queries. The system also leverages a multitude of click signals to improve the precision even further"... [I]t also covers other tools used by developers. For example, a Code Sample Answer can be triggered when searching for git commands and their syntax.

Bing extracts "the best matched code samples from popular, authoritative and well moderated sites like Stackoverflow, Github, W3Schools, MSDN, Tutorialpoints, etc. taking into account such aspects as fidelity of API and programming language match, counts of up/down-votes, completeness of the solution and more."

JAXenter.com notes they obtained similar results using the privacy-friendly search engine DuckDuckGo, and ultimately asks whether this functionality could affect the search habits of developers. "Is this new feature enough to make Bing a viable search engine tool for programmers or will Google be the go-to for hunting down source code?"
This discussion has been archived. No new comments can be posted.

Bing Now Provides Exact Snippets of Code for Developers' Queries

Comments Filter:
  • by xack ( 5304745 ) on Saturday July 21, 2018 @12:39PM (#56985926)
    It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.
    • by Fly Swatter ( 30498 ) on Saturday July 21, 2018 @12:49PM (#56985964) Homepage
      More likely will be snippets that download harmless sounding payload and execute.
    • Re: (Score:3, Insightful)

      by KiloByte ( 825081 )

      It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.

      I don't see a downside. Someone bad enough to code via cargo culting snippets shouldn't be allowed anywhere near actual data. Sure, it'd decimate Javascript and PHP coder base, but that's not a downside either.

      • It won't be long before stuff like fork bombs and data deleters get "suggested" for common programming queries.

        I don't see a downside. Someone bad enough to code via cargo culting snippets shouldn't be allowed anywhere near actual data. Sure, it'd decimate Javascript and PHP coder base, but that's not a downside either.

        Nothing wrong with whistling up a quick code snippet, as long as you understand it.

        • Nothing wrong with whistling up a quick code snippet, as long as you understand it.

          Exactly! Real programmers will spot the trap, cargo-culters won't.

    • by DogDude ( 805747 )
      They're taking the code from relatively reliable sources. You'd have to spam Github, somehow.
    • by Dracolytch ( 714699 ) on Saturday July 21, 2018 @01:39PM (#56986242) Homepage

      I just checked some quick examples in JavaScript, and didn't love the syntax it gave back as a result. Meanwhile, the StackOverflow pages in the search results provided much more correct answers. StackOverflow's answers often provide context, which is very important when building software.

    • No one would suggest a fork bomb on the Internet.

    • Example, or explanatory, code very frequently comes with a note such as "data validation and error handled omitted for clarity". They aren't kidding - important code is left out in order to leave bare only what's being demonstrated. Putting such code online without proper validation and error handling is putting a glaring security hole in place.

      I wrote a snippet of demo code years ago which was put into production on hundreds of thousands of web sites, though it should not have been. I demonstrated an idea

      • by Anonymous Coward

        I think you really should type up an article explaining why the code snippet is wrong and how to do it correctly, and then link that article here and other places when you talk about it. That way the search engines will eventually start serving up the right answer, and history will credit you as the one who taught everyone the right way to do it.

        tl;dr: Please write an article and start linking to it.

  • by Applehu Akbar ( 2968043 ) on Saturday July 21, 2018 @12:52PM (#56985982)

    Let me guess: it's always C# ?

  • Every time, I'm shocked that Bing still exists.
  • "give me that piece of code that you use to generate code"
  • by richrz ( 1624799 ) on Saturday July 21, 2018 @01:22PM (#56986146)
    Now I can forward more stuff to look smart!
    • Comment removed based on user account deletion
    • by Dast ( 10275 )

      Manager: "What are you talking about, 2-4 weeks? This problem shouldn't take you more than an hour. Just ask Bing for the code!"

      Developer: "Bing, tell me what code to add to Windows to make it suck less."

  • Bing extracts "the best matched code samples from popular, authoritative and well moderated sites like Stackoverflow

    If it got popular enough, this would impact the number of upvotes. And the whole idea of StackOverflow is that upvotes determine a working answer.

  • Just tried three of the most basic code questions I could think of, wrong answers every time:

    "C++ opengl draw triangle" returned:
    float c = -1.0 + 2.0*desiredPixel/pixelWidth

    "C++ opengl set vertex shader" returned:
    // (Vertex buffer must be bound at this point)
    glEnableVertexAttribArray( a ); // 'a' would be 0 if you did the latter
    glVertexAttribPointer( a, 3, GL_FLOAT, GL_FALSE, sizeof( your vertex ), nullptr );

    "C++ directx 11 create 3d texture" returned:
    desc.BindFlags = D3D11_BIND_SHADER_RESOURC
    • Nope, nope, nope...

      At least you got an answer. I queried about transparent connection to IPV4/IPV6, about accepting a TCP connection, and about multiplying to matrices in C, and I got zilch...

  • Code samples are pretty much always "not for proudction".
    It's good that samples are easily available, as code often explains a concept better than documentation for many developers.

    The risk is that these samples are just copied in to an application with all the codesmells that it contains.
  • Not a good thing (Score:4, Insightful)

    by gweihir ( 88907 ) on Saturday July 21, 2018 @01:54PM (#56986310)

    It will allow some "developers" that have no clue what they are doing to fly under the radar for some more time and do more damage. And that is basically the only thing this will do.

    • Comment removed (Score:4, Insightful)

      by account_deleted ( 4530225 ) on Saturday July 21, 2018 @02:54PM (#56986562)
      Comment removed based on user account deletion
      • by gweihir ( 88907 )

        I fully agree on that.

      • All corporations remove support far away from developers.

        When I worked for Tivoli systems (just post-IBM-buyout) I was the liaison between my team (TME10 Inventory) and the developers. I brought our concerns to them, and they would address them. I would ask them questions about how the product was actually supposed to work, and I would bring those responses to my team. Sometimes I would literally overhear one of my coworkers giving a customer the wrong answer, and I would be able to tell them "no, that's not how that works" specifically because not all corporatio

    • True. I don't think I'd ever trust what a search engine thought was the correct answer from SO. I'd be much more comfortable looking to see the context of the code. Was there disagreement about the answer, or an alternate approach not marked as answer but with a higher rating? Were there caveats? Is there additional error handling required?

      This is all stuff a responsible programmer would definitely want to know when they get their answer.

      • It's like the programming equivalent of an automatic shotgun, where someone thought that shotguns needed to fire faster and less accurately.
        • It's like the programming equivalent of an automatic shotgun, where someone thought that shotguns needed to fire faster and less accurately.

          If your goal is to throw a lot of lead into a crowd real fast, an automatic shotgun is relatively practical. Or if you want to use less-lethal rounds like beanbags, and expect to have to engage multiple assailants with them. So no, it's nothing like that, because those make sense and this doesn't.

    • by gtall ( 79522 )

      Well, that and it means MS is spewing their code around, probably contains STDs.

  • So they're stealing page hits and ad impressions of the sites providing this code. Google does the same thing when you ask it questions - they show what they believe to be the answer, with a link to the source...which you'll probably never click through to, because you've already gotten your answer.
  • I can't help but think that this feature has more to do with the recent acquisition of GitHub than we know. Seems like Microsoft has started using your code to power its search engine and monetize your code. What about copyrights? Does it respect terms outlined in projects licences?
  • I'm, going to buy a workstation with 1TB of RAM and search in Bing "Windows implementation, course work". I hope this will bring an example of a working Windows source code and the browser won't crash.
  • by cascadingstylesheet ( 140919 ) on Saturday July 21, 2018 @04:02PM (#56986852) Journal

    It's been on DuckDuckGo for quite some time. Often quite useful.

  • by Anonymous Coward

    just change that stupid name already!
    id say thats 95% of reason why i dont use the stupid thing. the rest is the shitty search that dont find anything

"I've seen it. It's rubbish." -- Marvin the Paranoid Android

Working...