By Edward Basham
Creating and maintaining a code library to catalog your programming resources can reduce project development time and improve the reliability of your software. A code library will permit team members to quickly locate existing resources instead of reinventing the wheel. By recycling code that has already been tested, you can safely reduce the time devoted to Alpha testing. Cataloging your code can also enable you to track customers who use a given module so that their systems can be updated should the module be revised in the future.
A successful code library requires these five elements:
- Library application—You will need a relational database to house your library. You can create the database in-house or you can opt for a commercial package. As developers, this is the component we fear the least and it is usually not a stumbling block, provided we can argue that the investment in staff time will pay a dividend in the long run.
- Metadata—To locate entries in your library, you will need a searchable classification system. Formal classification categories usually include obvious values like module name, version, language, author, intended platform, filename, and location. You will also want to include informal categories for metadata of lesser importance or information that will appear on only a few records. Informal resources may include comments, references to the development tools used, a staff contact, or common variations on the spelling of a critical term. Formal classifications are best coded within the database structure so that users can apply them using check boxes and radio buttons. Informal classifications that are rarely used or of limited value to the organization as a whole may be included in a searchable text box using keywords (see Figure A). If a keyword becomes popular with users, it can always be formalized later. If you are developing your library in-house, be sure to provide for case-insensitive nested searches.
|Keywords for a JS resource using an experimental library|
- Flexibility—A code library must be adaptable and able to accommodate resources in a variety of formats and locations. Programming resources can include files, code snippets, Web sites, documents, graphics, licensing agreements, pricing schedules, and even printed manuals. Over time, you will need to alter, add to, or reorder your classifications. Keep this in mind during the planning stage for your library. Having to recode and recompile your library application to accommodate a new language or version release is inefficient and will delay the cataloging of related resources.
- Content quality—The quality of your library will hinge on the quality of the code it references. Make sure your code is well documented and compliant with the relevant standards and that any required support files are referenced in the library.
- Accessibility—A library must be accessible to multiple users or in a form that can be distributed by the librarian to coders and staff. Be sure to consider how the library will be accessed or distributed while still in the planning stages.
- The means to stay current—The value of a library to your organization will depend on the accuracy and completeness of the metadata it contains. In large environments, a code librarian may be justified. For most of us, the task of updating the main library can be assigned to the same staff person responsible for project documentation. I personally rotate this responsibility among staff so that everyone becomes familiar with the library and has a sense of ownership.
In most IT environments, the biggest hurdles to developing a code library are concern over the ratio of investment to return and lengthy deliberation over possible classification schema and terms. The use of a commercial package can significantly reduce startup costs and allow the staff to focus its energies on populating the library rather than on developing code for an internal project. Awake Software's CodeAssets is one such solution.
CodeAssets comes preconfigured with a variety of classification schemes (see Figure B). It is easily modified and resources can be exported to other users. Although written as a Windows client, resource files can be accessed over a network. The product supports multiple catalogs (called Repositories), includes a built-in backup feature, and comes with sample templates for common resources. For details or to download a trial version visit the CodeAssets site.
|Cataloging a DLL resource with CodeAssets Editor|
A code library can save time and improve the quality of the applications and software you develop. The flexibility to make changes to the library structure and the classification system over time can help prevent scope creep in the development phase and will ensure an acceptable lifespan for the end product. In small shops where resources for internal projects are limited—or whenever a low-cost solution is desired—a commercial package can reduce overhead and expedite implementation.