
Commutativity describes whether two operations produce the same result when their order is reversed. It does not claim that order is generally unimportant. We must specify which operations are being compared, what they act on and under what conditions.
Suppose an item costs $100. Applying a ten per cent discount and then adding $10 delivery gives $100. Adding delivery first and then discounting the total gives $99. These operations do not commute. By contrast, adding $5 and adding $10 gives the same total in either order, so those operations commute in this case.
Commutativity differs from reversibility, which asks whether an operation can be undone. It also differs from composability, which asks only whether operations can be connected. Commutativity is a relation between operations within a stated domain. When order changes the result, the process contains a dependency; when order does not matter, coordination and testing can often be simplified.
Discover more from Geoffrey Chen
Subscribe to get the latest posts sent to your email.