The Iterator: The Death March
Traversing the elements of an aggregate object sequentially without exposing its underlying representation.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Conjuration // Threadmancy
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
IT'S SHOWTIME
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE TOTAL_ENEMIES
GET TO THE CHOPPER TOTAL_ENEMIES
HERE IS MY INVITATION 5
ENOUGH TALK
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE CURRENT_INDEX
GET TO THE CHOPPER CURRENT_INDEX
HERE IS MY INVITATION 0
ENOUGH TALK
LISTEN TO ME VERY CAREFULLY HAS_NEXT
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE INDEX
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE TOTAL
GIVE THESE PEOPLE AIR
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE IS_LESS
GET TO THE CHOPPER IS_LESS
HERE IS MY INVITATION TOTAL
LET OFF SOME STEAM BENNET INDEX
ENOUGH TALK
I'LL BE BACK IS_LESS
HASTA LA VISTA, BABY
LISTEN TO ME VERY CAREFULLY NEXT_TARGET
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE INDEX
GIVE THESE PEOPLE AIR
TALK TO THE HAND "Terminating target at index:"
TALK TO THE HAND INDEX
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE NEW_IDX
GET TO THE CHOPPER NEW_IDX
HERE IS MY INVITATION INDEX
GET UP 1
ENOUGH TALK
I'LL BE BACK NEW_IDX
HASTA LA VISTA, BABY
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE RUNNING
GET TO THE CHOPPER RUNNING
HERE IS MY INVITATION 1
ENOUGH TALK
STICK AROUND RUNNING
I NEED YOUR CLOTHES YOUR BOOTS AND YOUR MOTORCYCLE CHECK
GET YOUR ASS TO MARS CHECK
DO IT NOW HAS_NEXT CURRENT_INDEX TOTAL_ENEMIES
BECAUSE I'M GOING TO SAY PLEASE CHECK
GET YOUR ASS TO MARS CURRENT_INDEX
DO IT NOW NEXT_TARGET CURRENT_INDEX
BULLSHIT
GET TO THE CHOPPER RUNNING
HERE IS MY INVITATION 0
ENOUGH TALK
YOU HAVE NO RESPECT FOR LOGIC
CHILL
TALK TO THE HAND "Area clear."
YOU HAVE BEEN TERMINATED
The Iterator: The Death March
A machine gun does not care how the bullets are stored in the belt, only that the next one is chambered when the trigger is pulled. The Iterator pattern provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
Using ArnoldC, our death march leverages STICK AROUND (a while loop) paired with custom HAS_NEXT and NEXT_TARGET subroutines. We abstract the counter increment logic, creating an iterator that consumes the hit-list flawlessly.
Runic Tags:
#behavioral
#iterator
#arnoldc
#traversal