Extension in UML

Like the include relationship, the extension relationship is drawn on a UML use case diagram as a dashed dependency arrow between the main use case and the optional extension use case. Howevver, on first sight the direction of the arrow seems unintuitive. It is actually drawn from the extension use case back to the parent use case that it extends. The dashed arrow is labelled with the stereotype <<extend>> to indicate that the use case at the back of the arrow extends the main use case beyond the arrow head. Our vending machine example is shown in the diagram below. Note how we have assumed that all transactions may wish to request a receipt, hence the extension is applied to taking payment rather than the specific purchases themselves: