Loop-switch sequence
Appearance
Loop/Switch sequence
A specific derivative of the spaghetti code AntiPattern which achieves it's crapulence from the encoding of a clear process of steps in a byzantine switch within a loop.
Example of Antipattern
String key; String value; String extension;
for ( int i = 0; i < 3; ++i ) {
switch( i ) { case 0 : key = stream.parse(); break;
case 1 : value = stream.parse(); break;
case 0 : extension = stream.parse(); break; }
}
Refactored Solution
String key = stream.parse(); String value = stream.parse(); String extension = stream.parse();