Antonym List

December 10, 2019 ยท View on GitHub

Note: The table headings (positive/negative) are not necessarily meaningful.

PositiveNegative
acquirerelease
addremove (e.g. an item), subtract (arithmetic)
advanceretreat
allocatedeallocate (correct), free (common)
allowdeny
assembledisassemble
assigndeassign (e.g. a task)
associatedissociate
attachdetach
beginend
bindunbind
commitrollback
compiledecompile
compressdecompress
connectdisconnect
constructdestruct
createdestroy
doundo
enabledisable
encodedecode
encryptdecrypt
enqueuedequeue
enterleave, exit
expandcollapse (e.g. a tree view), contract
firstlast
freezeunfreeze
frontback
getset
grantrevoke
headtail
importexport
includeexclude
increasedecrease
incrementdecrement
indentdedent
inflatedeflate
injecteject
inputoutput
insertdelete (e.g. from a collection), extract (e.g. in a stream)
installuninstall
linkunlink
loadunload (e.g. a module), save (e.g. state), store (e.g. a value)
lockunlock
maximumminimum
newold
nextprevious
openclose
composeparse
pastecut
pushpop (e.g. a stack item), pull (communication strategy)
raiselower
readwrite
referencedereference (e.g. a pointer), unreference (e.g. an object in the case of reference counting)
registerderegister
resumesuspend
selectdeselect
sendreceive
serializedeserialize
setunset (e.g. a key), clear (e.g. a bit), get (e.g. a value)
set uptear down
showhide
startstop
start upshut down, clean up (maybe)
updown
upperlower

Remarks

Motivation

Using sensible, consistent wording in APIs improves readability, usability and greatly helps new users getting started. There is nothing more annoying than wondering what a function call is supposed to do while reading (someone else's or your own) code.

Initialize

There is no precise antonym for initialize and I don't think there has to be: By using initialize only for simple initializations that don't need any clean up code (initialize as its own antonym) you can

  1. establish a convention through that initialization routines without a corresponding clean up routine can be easily recognized, and
  2. circumvent the need for an antonym ;).

For routines that do not fall into this category, select another verb from the table above (most of the time there is a more descriptive alternative anyway).

If you still feel like you need an antonym; possibilities include but are not limited to: exit (very common in conjunction with init), reset, finalize, terminate.

"De-" vs. "Un-"

Both prefixes (de- and un-) can be defined as a reversal of action. Most of the time the prefix de- is used for verbs while un- is used for adjectives. There are many exceptions to this rule though. In some cases careful usage of these prefixes can avoid ambiguity. For example, "he was unregistered" is ambiguous because it can mean either "he was not registered" or "his registration was removed", while "he was deregistered" is not.