Code Search?

We added ‘suggest a feature’ last week . It’s an anonymous web form to suggest features to Ohloh. The response has been great – many to thank to all who’ve contributed ideas.

I noticed some of the suggestions are requests for features Ohloh already supports. While it’s slightly frustrating to read, I very much appreciate these suggestions. – it means we need to simplify these features.

In the category of suggestions of features we don’t yet support, I’ve been surprised how much I found myself agreeing wholeheartedly with the features mentioned. One recent idea, however, gave me pause. The feature was: “code search capabilities”. I’ve seen how a bunch of sites already do this: google code search, koders, codase, etc… This makes adding the feature less interesting for me – it’s already done. However the real reason for this post is that I don’t understand the value of code search. I code for a living so I figure I have some knowledge here. I grep my own source tree many times a day. However I fail to see the value of searching keywords in random source code.

With so many sites offering this functionality (and with the recent suggestion), I’m wondering: what is it, exactly, that I’m failing to “get” about code search?

  • bcannon (Brett Cannon)

    For developers of open source frameworks, it can be helpful in determining how widely used a feature is. This can come into play when deciding whether the feature can safely be deprecated or not. It can also be used in ammunition when someone comes along and complains that a feature going away is used a lot by them. Having hard numbers saying that the rest of the world doesn’t use it is handy.

    But I personally use Google Code search so I personally don’t see why you guys need to add it. Maybe you can just have a Google Code search box or something to make it simple if demand keeps up for the feature.

  • jason (Jason Allen)


    Very valid point – however I’d argue that it’s a fairly narrow case.

    I’m currently at foo camp and did an informal poll of around a dozen developers at my lunch table and the data supported my view – no oned owned up to using it.

    I think there might be a google code developer here – I’ll try to get his perspective…

  • I think the only sense behind code search is finding exploitable code. I won’t like to se this on Ohloh.

  • Tobias:
    I use Google code search everyday, and it have never been to search exploitable code, but to learn undocumented libraries or find live working samples on how to use something, so, why do you think this way?

  • jason (Jason Allen)

    opsidao: I’m curious to learn more about how you use it.

    1. Undocumented Library – why don’t you search the code locally? It seems very useful to have exact control over the version of the lib you’re binding/calling to.

    2. Code Examples – I find a google web search typically yields reasonable code snippets using the API call – often embedded as part of a thoughtful/useful article containing interesting metadata.

    Here’s an idea: could you suggest a specific example where you feel code searching outperforms local grep-ing or web searching?

  • bcannon (Brett Cannon)

    Oh yeah, its narrow. =) python-dev does not use it very often, I just know it has been used that way before.

    I think you are right and that code search is just not needed.

  • Searching for working examples of some code works fine by using normal web search, while you might get documentation examples here first, which can even be more helpful than just a snippet of code without knowing the context.

  • jason (Jason Allen)

    Tobias – I totally agree!

  • Levia (Lars Wesselius)

    As far as that it is already done – that is true, but its a fairly new service. What Ohloh could do is provide some new search methods, or more options for the code search module. So Ohloh could still be innovative in that regard.

    On the other hand, it is still about the code search – providing some new options would only boost the idea a bit further, still, its still about the main idea – the code search itself.

    Now, I found myself using, or accidentally using, code search almost every day. When I can’t find something when writing code, I ask Google, and then you’ll most probably stumble upon one of the code search sites with the code in it I looked for.

    Personally, I think code search isn’t needed, but if it’s going to be there, then it wouldn’t be bad, especially if your going to provide some new options/functionality.

  • I personally can’t figure out how a code search engine could become useful to Ohloh members.

    I think Ohloh’s best feature is innovation: since its birth the website has offered a wide range of new options and functionalities I rarerly was able to find in other portals — keep this idea going and go on innovating!

  • Speaking of innovations – What about automatic symbol search? For example, a Java library defining a few classes could be notified (somehow) when some other library uses its API.

    Pff.. I should go and submit it to the feature requests!

  • jason (Jason Allen)

    aviadbd: I’m not sure I understand your suggestion – care to elaborate?

  • I think that suggestion may relate to something I seem to remember being mentioned about deriving metrics relating to what open source projects a project uses?

  • That would indeed be a cool feature!
    Measuring how much a library is used by other projects, take libSDL for example, the page could say something like this:

    libSDL is a low level multimedia library used by xxxx other projects (→ See Which projects are using libSDL)

    And `xxxx’would then be a number that updates say, once or twice a week.

    And it would be very useful to be able to find all projects that use libSDL and LUA for exampele.