: ''Pop goes the weasel.'' [From ComplementaryNames] One example of a bad complementary pair is ''push'' and ''pop'' (the opposite of ''push'' is ''pull''). ''Referring to PushAndPop as a bad complementary pair is like referring to an apple as a bad orange. Popping is a consequence, not an opposite. Anyone trying to stuff one too many books onto a bookshelf understands this concept all too well.'' * Does anyone know when the terms PushAndPop became associated with TheStack DataStructure? First published reference? ** The LastInFirstOut concept for subroutines is credited to WillemLouisVanDerPoel. A UseNet thread there claims that "PUSH and POP were first used in 1963 on the Burroughs B5000. Designed by Bob Barton." ''Remember context - and those little spring toys that '''pop''' after you '''push''' them'' Exactly what "context" am I supposed to remember, other than "this is how computer people talk"? The reference to the spring toys is helpful in terms of complementarity, although I think the relevance to stacks (where ''push'' and ''pop'' are used most often) is unclear. Ask ten non-programmers what the opposite of ''push'' is, or ask them each for three words that are related to ''push''. Or ask ten non-programmers to describe the process of stacking some objects and then removing objects from the stack. I doubt you will hear the word "pop" during any of these exercises. The point here is that programmers' use of the terms "push", "pop", and "stack" together does not jibe with natural language. There is nothing wrong with that, but let's not forget this is jargon and that it may be confusing to intelligent people who are not in on it. If you have convinced yourself that "push" and "pop" naturally go together, you may be unintentionally using these words and other such jargon in non-technical contexts, confusing people and strengthening the perception that we enjoy making everyone else feel stupid. Use of good ComplementaryNames improves communication. There is usually no reason to use non-complementary terms other than carelessness. ---- I always understood ''push'' and ''pop'' (and the LIFO stack) as the tray dispenser in my dining hall at college (I think I learned it from a ForthLanguage book that made that analogy). I suppose ''put'' and ''take'' would work just as well, but ''put'' and ''take'' could also be used for a bag. ''Apparently redundant comment moved up from bottom of page to point where duplication is obvious (read before writing, eh?):'' My recollection of the first time I heard about software stacks was that they mirrored things like the dish stacks in the cafeteria. When you take the top dish, another one pops up. With that metaphor in mind, "pop" makes perfect sense. You don't pull the dish up -- it pops up. ---- I'd be interested to hear if anyone who has not read any computer books has ever used the terms ''push'' and ''pop'' for tray dispensers or any other stacks. It's much more likely that non-geeks would use the terms ''pull'', ''pick up'', ''draw'', ''remove'', or ''take'' to describe the operation of removing the top item from a stack. ''Things like gun magazines and printer paper holders come to mind as things into or onto which one '''pushes''' objects and then '''pops''' them off the top.'' '''Ask ten non-programmers (CEO's, mimes, semi-professional ballroom dancers etc.) to keep "pushing" marshmallows into an empty paper towel tube and, using their natural language(s), they will likely describe the consequences of this action as marshmallows "popping" out the other end.''' ---- "Pop" as an onomatopoetic verb: * exploding (as in firecrackers, popcorn, or rice crispies) * jump up (or out) quickly ("Pop goes the Weasel", popup ads). Things that "Pop" like a stack: * gun magazines * Pez dispensers These things don't "Pop" but they exhibit stack-like behavior: * tray dispensers * paper cartridges * playing cards * Vinyl records on a spindle "Stacks of Wax" ---- But note that the 6502 (http://en.wikipedia.org/wiki/6502) has a set of "push" (PHA, PHP) and "pull" (PLA, PLP) instructions. The 6800 (http://en.wikipedia.org/wiki/Motorola_6800) also does "push" (PSHA, PSHB) and "pull" (PULA, PULB). ---- I don't remember the system (it may have been Sigma 7) but I do remember the rationale: Push/Pull was for a queue (FIFO), Push/Pop was for a stack (LIFO). --mt ---- '''Programmer's Cheer''' Shift to the left! Shift to the right! Pop up, push down! Byte! Byte! Byte! ---- See also ReversePolishNotation