Database of code fragments


General J2EE: Database of code fragments

  1. Database of code fragments (1 messages)

    Hi there,

    in our company, a couple of people have brought up the idea
    of creating a Java application that maintains and
    categorizes pieces of Java (and possibly other) code, so
    people doing new development could reuse stuff others have
    done before them.

    Since this is probably a larger task, buying some commercial
    product would definitely be an alternative, so my question
    is: Has anybody ever come across an application like this?
    Requirements or at least nice-to-haves are full text index and integration into CVS.

    Or (if we decide to build a solution on our own): Are there
    any web pages out there that deal with this subject and
    give some hints about possible strategies, algorithms and

    Thanks in advance,
  2. Database of code fragments[ Go to top ]

    Trying to reuse code fragments runs counter to good Object-Oriented design. If you want to reuse code, you ought to put that code into its own class, and then reuse the class itself. Developing and maintaining a good class library is the best way to get good reuse.

    The only case where this might not be practical is if you want to reuse a design pattern of some kind. In that case, you are better off using some kind of code generation strategy. Look at XDoclet or VDoclet or any of a variety of books and articles on code generation.