4. version-controlled snippets so you can know if there are improvements / errors
add that, and we're golden. But stale copy/paste code is flat-out dangerous, and that's all this really is from a code standpoint, with a bit of magic and discovery. Not that I'm downplaying the tool - I think it looks really good. Just that using community-generated code is dangerous unless you either carefully curate it, or understand everything it does.
But what if the code looks beautiful and right, but hides a rare bug that the designer doesn't know about?
I totally agree, it's over-sold. But any time you're using something you don't fully understand, you run risks. Being able to be informed of updates / problems would change the entire practice of re-using snippets, and integration into an IDE is the perfect way to do so. You, as a contributor, could even learn of problems / improvements that others have found.
"But what if the code looks beautiful and right, but hides a rare bug that the designer doesn't know about?"
All I'm saying is, in my experience, developing systems and apps for 10 years, the "rare bug" you talk about is just not a big enough problem to warrant that kind of caution.
Because the kind of code that you put in a snippet and reuse is the kind of "glue" or boilerplate code that is a solved problem.
What do you think of the version of the code I posted at http://news.ycombinator.com/item?id=2904572? I originally wrote it in response to your comment, "Not everything should be abstracted into a library. I think the example in their screencast is a good one," but then I thought it might have wider interest.
Thanks, versioning is really important. By default, when you create a snippet, it only appears in your search results. There is an option to submit a snippet to be included in the shared results. We're building a moderation system to handle those submissions. In the meantime, we're manually approving submissions to the shared repository. The moderation system will include versioning.
We're also building a feature to allow users to define groups and share snippets with groups.
Good to hear :) How are you planning on tracking where snippets are used? I personally liked an idea I saw once of 'tagging' snippets with their Gist URL in a comment above the code, but it was a fatally-crippled idea because no IDEs supported such things transparently.
As much of a hell as it will be to add / maintain, can I also request that they have version + library dependencies listed somewhere, somehow, so you automagically get the most-correct one? I realize I'm asking for a package management system, and I have yet to see one that isn't fugly, but I can dream, can't I? At the very least, I figure language-version is a necessity due to syntax changes.
This is actually already partially implemented. If you insert a snippet that includes a method/class (e.g. search for "screenshot"), a comment uniquely identifying the snippet is included in the inserted code. We currently aren't inserting these comments for the smaller snippets because we thought it would be annoying (but we could implement an option to enable it). It would be pretty easy (once versioning is up and running) to notify programmers when newer versions of the identified snippets are available.
Very good point Groxx, my own experience with this was looking for some snippets recently and Google ended up directing me to DZone Snippets[1] for and what I found were snippets from Java 1.3 to do the task that in Java 6 had been completely reworked with some of the new APIs and language features.
So you have a very good point, for longevity, that the snippets need to be versioned.