Solution (source code)

= Solution

The <Command pattern> separates a request into a common command interface, concrete commands carrying arguments and execution behavior, a receiver doing the application work, an invoker requesting execution or retaining history, and a client assembling these <software objects>. A menu item, toolbar button or keyboard shortcut can invoke the same command without duplicating the playlist manipulation.

\b[`SongSuite` is the receiver.] The application/controller invokes its operations, and the returned `Change` <software objects> hold the concrete inverse/forward behavior. A command wrapper can expose an initial `execute` that calls the appropriate `SongSuite` operation and then delegates later undo/redo to its returned record. `History` is the history-managing part of the invoker. Separating these roles avoids making a graphical control know how the playlist representation is edited; requests can be retained and reversed through a common <object interface>.