- Published: Wednesday, 09 October 2013 12:38
- Written by JPro Extensions
- Hits: 216
The switch() loop, evaluates an expression, matching the expression's value to a case label, and executes statements associated with that case. This method can be a source for tricky bugs that usually happen, especially with novice programmers. Also, it's more of a procedural programming type than an object oriented one. There are also performance benefits using the Object Oriented Programing (OOP) approach of the switch loop, which can be applied using the Command Design Pattern.
Here you'll find the two methods and basic code for testing and future usage, as well as notes explaining the risks of using the switch() loop and, the benefits of using the Command Pattern approach in your future development processes.