Talk:Snippet (programming)
Appearance
FoxPro
FoxPro was the first IDE with snippets. Mathmo Talk 20:41, 28 May 2007 (UTC)
Difference between snippet and some other concepts
How does a snippet differ from other reusable programming constructs, such as functions, macros, objects, and the like? Perhaps the article could go into some detail on this subject? I don't know enough to do the edits myself. Flewellyn (talk) 21:43, 18 February 2009 (UTC)
- IMHO, a snippet is just a piece of code, normally (but not necessarily) contiguous. It is not necessary a modular unit; for instance, four arbitrary sequencial lines of a routine would qualify as a snippet.
- It does not even need to be valid (compilable/executable) code as is. For instance, suppose an algorithm implemented in a given programming language. In a snippet extracted to discuss the implementation of that algorithm, the contents of one of its inner loops may be omitted and replaced by "..." to explain the basics of a portion of that algorithm while ignoring irrelevant details to that explanation. So a snippet does not need to be created with reuse in mind; there can be snippets for didactical reasons too.
- Thus, snippet would be an umbrella term for all those modular units you have mentioned and even pieces of code that are just part of a module (or parts of different modules). However, the term is typically used to refer to a small piece of code. It would be somewhat misleading to call a module of many KLOC a snippet. --Antonielly (talk) 22:10, 18 February 2009 (UTC)