Timeline for Can the Strategy pattern be implemented without significant branching?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 30, 2018 at 1:02 | comment | added | Shadow Man | Switch statements (and long if/else-if blocks) are bad and should be avoided if at all possible in order to keep your code maintainable. That said "if at all possible" acknowledges that there are some cases where the switch must exist, and in those cases, try to keep it down to a single place, and one that makes maintaining it less of a chore (it's so easy to accidentally miss 1 of the 5 places in the code that you needed to keep in sync when you don't isolate it properly). | |
May 8, 2012 at 19:15 | vote | accept | Michael K | ||
May 1, 2012 at 19:34 | comment | added | Michael K | I don't see it as a bad thing either. However, I'm always looking for ways to reduce the amount of code maintaining it would touch, which prompted the question. | |
May 1, 2012 at 19:21 | history | edited | pdr | CC BY-SA 3.0 |
edited body
|
May 1, 2012 at 19:15 | history | answered | pdr | CC BY-SA 3.0 |