Jump to content

Talk:Snippet (programming)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Antonielly (talk | contribs) at 22:10, 18 February 2009 (reply to Flewellyn). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

FoxPro

FoxPro was the first IDE with snippets. Mathmo Talk 20:41, 28 May 2007 (UTC)[reply]

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)[reply]

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)[reply]