Though neither blessed by formal methodology (think "reusable code" from a pure object oriented perspective) nor subject to serious classification schemes, the term "code snippet" nevertheless enjoys a well-known and appreciate position in the Visual Basic world. Basically, a code snippet is a small chunk of code that manages to be handy, functional, and intelligible enough to circulate in its own right, and to find its way into all kinds of programs or projects. In fact, SearchVB.com operates its own repository of such gems at VBCode.com.
Though it may provide neither inspiration nor content for creation of new code snippets in and of itself, the Microsoft Visual Basic Developer Center does offer a handy-dandy Code Snippet Editor for Visual Basic 2005.
Basically, it's a Windows Forms application that provides a UI specifically designed to help developers create, edit, and test VB code snippets. Thus, it's something that should appeal not only those inclined to look for ways to re-use their code, but also to those inclined to look for ways to re-use existing snippets in their own work -- like the many snippets available at the aforementioned VBCode.com Web site. In fact, Visual Basic 2005 itself includes hundreds of code snippets that also provide a useful fodder for constructing a useful custom snippet library of your very own.
The Code Snippet Editor lets you interact with snippets visually, so you can easily define custom replacement parameters for your snippets, add custom metadata to describe them (title, author, description, and so forth), define keyboard shortcuts for quick access to favorite snippets and define reference assembles for snippet use. This cool and helpful little tool is part of the Microsoft shared-source project, so you can not only work with its developers to improve the existing version or suggest enhancements and improvements, you can even download its source code from gotdotnet.
Though the current version is a release candidate, a final release is already underway. After playing around with it myself, I can say it's already pretty useful and more or less ready for prime time anyway.
Ed Tittel is a full-time writer and trainer whose interests include XML and development topics, along with IT Certification and information security. Send comments, queries, or suggested topics or tools for review to Ed at firstname.lastname@example.org.
This was first published in March 2006