The Strategy of Sort Algorithms
Swappable rituals for processing arrays of variant data.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' ISortStrategy.cls
Public Sub Sort(ByRef arr() As Variant)
End Sub
' BubbleSortCurse.cls
Implements ISortStrategy
Private Sub ISortStrategy_Sort(ByRef arr() As Variant)
' The most inefficient and evil sort possible
End Sub
The Strategy pattern provides a way to inject different algorithms into a host context at runtime. In the dark ages, passing objects implementing ISortStrategy circumvented the lack of function pointers.
Runic Tags:
#strategy
#sorting
#variants