A snippet is a small section of text or source code that can be inserted into the code of a program or Web page. Snippets provide an easy way to implement commonly used code or functions into a larger section of code. Instead of rewriting the same code over and over again, a programmer can save the code as a snippet and simply drag and drop the snippet wherever it is needed. By using snippets, programmers and Web developers can also organize common code sections into categories, creating a cleaner development environment.
Snippets used in software programming often contain one or more functions written in C, Java, or another programming language. For example, a programmer may create a basic "mouse-down event" snippet to play an action each time the user clicks a mouse button. Other snippets might be used to perform "Open file" and "Save file" operations. Some programmers also use plain text snippets to comment code, such as adding developer information at the beginning of each source file.
Updated: January 15, 2009