On 7/14/07, sy1234 <sy1234 / gmail.com> wrote:
> This is a longish post.. there were bunches of ideas rattling around in
> my head.
>
>
> I've been wondering how I can manage my snippets of code.  I try to
> experiment with self-contained examples whenever I have a particularly
> interesting problem I want to remember the solution to.  But it's all
> disorganized, and sometimes it's housed past my __END__ statements at
> the end of various half-finished scripts.  That's a great way to lose my
> snippets.  =)
>
> It's a horror for me to suspect that I know how to solve a problem, and
> that I've done it before, and not quite remember how I did it before
> because I can't find that one block of code.
>
> The one thing I know about myself is that I will never entirely and
> reliably remember enough of my past solutions.  I know this is
> unrealistic for most people but I know that it's entirely impossible for
> me.  No matter how I absorb myself with something, I'll always forget
> bits of the knowledge.  On the plus side, this makes me great with
> documentation since I write everything down.  =)
>
> So, I want to house all of my snippets within a useful and
> easily-used/searched documentation structure of some kind.  Because this
> is an itch, my personal rule/habit is for me to lay down some code to
> solve the problem for myself.  But this seems like a large-ish project.
>
> What I really wanted to learn is:
>
> Do you use a snippets-helper of some kind?  If so, what?
> Do you think it's a good idea for me to make my own tool and then
> outgrow it and use someone else's afterwards?
>
>
> It's not a problem for me to reach out and find a couple of dozen
> websites and applications which would solve this problem.  But I just
> wanted to hear some opinions/testimonials for existing tools.  Some
> people may use some interesting solutions that I might not find by googling.
>
>
> But a self-created database feel simple on the surface -- just a few
> fields, each are searchable: topic(s), title, abstract, keywords, code
> code, example code, example output, 'see also' links, notes and maybe
> some other stuff.  I'd learn a bit of database stuff and some helpful
> new libraries.  It sounds like a definable project whose
> completion-payoff would be incalculable.  Actually, it sounds like a
> Rails project, but I'm not ready to go there.
>
> But I kindof imagine being able to search through all of my existing
> projects to find real-world examples of the code in use.  And then I
> could somehow embed comments within my code which talked about the code
> and helped the searchability.  That's definitely way over my head, but
> if it were implemented elsewhere I'd love to use it.
>
> There are some nice documentation systems out there but they seem
> focused around single-project documentation and not on gathering info
> and searching through an entire messy and unrelated collection of
> scripts like what I'd want.
>

I think that is a good idea to start doing learning tests
(http://c2.com/cgi-bin/wiki?LearningTest). Just organize your
self-contained examples in unit test cases and give them proper names.
Then "grep" will do.