Jump to content

Magic string

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Daydreamer302000 (talk | contribs) at 16:28, 6 November 2008 (Created page with 'The '''Magic String''' anti-pattern is a situation where a programmer defines an input that they believe will never come externally, and uses it in a conditional to...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

The Magic String anti-pattern is a situation where a programmer defines an input that they believe will never come externally, and uses it in a conditional to invoke otherwise hidden functionality. A user of this program would likely provide input that gives an expected response in most situations. However, if the user does in fact innocently provide the pre-defined input, invoking the internal functionality, the program response is often quite unexpected to the user (thus appearing 'magical').