Sourcegraph: "A single example is worth 1000 lines of documentation"
codeinsider.us
codeinsider.us
There are many cases where explaining things is better, and a well-crafted explanation with a few sparing examples is often the best way to communicate an idea — but there are some cases where a particular example is clearer than any explanation could hope to be.
It may have, but perhaps didn't present the UI for external users. Our internal version of Codesearch based on Grok (http://www.stanford.edu/class/ee380/Abstracts/121010.html) is far more powerful and works just like an advanced IDE -> find usages, callers, implementors, overrides, all kinds of auditing/analysis layers too.
Some Googlers practically live in Codesearch rather than use the local IDE indexing :)
Codesearch is probably the largest reason I am jealous of my friends at Google.
Doesn't clang (using a frontend like YCM[1]) provide exactly that?
At the end of the day I love Javadocs though - I really feel like I get the best understanding from them because of ability to easily browse packages, go up and down inheritance hierarchy, see all implementing classes, and there are typically some good examples in it too.
Which reminds me of another idea which I think I remember Jeff Attwood talking about: We all copy these snippets from websites into our code. Those snippets might have bugs that are later fixed by others on the web, or the APIs change or get deprecated, etc. It would be good to have a reference from the code to the web page so in the future you can remember where that snippet came from and look it up and maybe see if the community's recommendations have changed. But even better would be if the bugs that were fixed by the web-community ended up back in your code automatically. So imagine Stackoverflow with a gist-type comment system for the code snippets with versioning and community editing, and then you could somehow do a pull on those gists and grab the community's wisdom automatically.
That said, I do agree that if you've make choices in your code based on information that you found online, its good to include a reference to the source in a comment.
.. and bugs that were introduced by the web community were automatically introduced into your program?
Besides, I suspect that copy-paste-modify makes this impossible to automate.
For apache configuration, give me the examples!
I really like the use case of helping upstream maintainers decide on method deprecation/adding helper functions. Fantastic idea
Depends on the example, as other users said.
Sometimes the documentation tells you exactly what you need. Sometimes you want an at-a-glance example. And sometimes you might want to dive into the source to figure out what's going on. Whatever it is you're doing to understand a piece of code, we want to make it as easy as possible.
You're right, some times a code sample might make things clearer, especially for newbies.