Transient uses classes and generic functions to make it possible to define new types of suffix commands that are similar to existing types, but behave differently in some aspects. It does the same for groups and prefix commands, though at least for prefix commands that currently appears to be less important.
Every prefix, infix and suffix command is associated with an object, which holds information that controls certain aspects of its behavior. This happens in two ways.
That in turn makes it possible for third-parties to add new types without having to convince the maintainer of Transient that that new type is important enough to justify adding a special case to a dozen or so functions.
Two commands may have the same type, but obviously their key bindings and descriptions still have to be different, for example.
The values of some slots are functions. The
reader slot for example
holds a function that is used to read a new value for an infix
command. The values of such slots are regular functions.
Generic functions are used when a function should do something different based on the type of the command, i.e., when all commands of a certain type should behave the same way but different from the behavior for other types. Object slots that hold a regular function as value are used when the task that they perform is likely to differ even between different commands of the same type.