Content deleted Content added
m Remove link - The word byzantine here has nothing at all to do with byzantine failure - it's just being used as a word |
Clarify statement and clean up style - it may still be worthwhile to eliminate it for the sake of human readability |
||
Line 1:
A '''loop-switch sequence''' is a specific derivative of the [[spaghetti code]] programming [[antipattern]] where a clear set of steps is implemented as a byzantine switch-within-a-loop. Also known as "The FOR-CASE paradigm" [http://thedailywtf.com/Articles/Switched_on_Loops.aspx].
'''Note: ''' it is not necessarily an [[antipattern]] to use a switch statement within a loop. It is only incorrect when used to model a known sequence of steps. The most common example of the correct use of a switch within a loop is an event handler. In event handler loops, the sequence of events is not known at compile-time, so the repeated switch is both necessary and correct. (see [[Event-driven programming]], [[Event loop]] and [[Event-driven finite state machine]]). Also regarding the alarm that could trigger the possible performance loss that a conditional inside a loop could bring. Today modern compilers are capable in some cases to transform the loop with conditional(s) into a construct with better performance
==Example of antipattern (pseudocode)==
|