12
D4WKINS
3y

Telling my kids this was suicide squad

Comments
  • 3
    its nice to use switch sometimes
  • 4
    I take one look at 300 lines of if-else-if blocks and pull a blame.

    If the dev is still around I make a point to bring it up on standup and make them rewrite the whole thing in a switch block.

    Nobody wants to maintain that pasta bullshit.
  • 5
    Put functions in a dictionary, like a real boss.
  • 0
    Switch and If/Else-If debates? Pardon my annoying remark, but for extendable solution, it's not even a workaround.
  • 0
    Shit quality meme.
  • 0
    Use a map. Easy to trace and runs in O(1) (thought not a great optimization for smaller set)
  • 0
    "The CIA wants you to think it's if-then-else..." - Terry Davis
  • 3
    I prefer Haskell's guards, Rust's & Scala's match... hell, even Kotlin's when expression and PHP 8.0's match expression.

    For one simple reason: In most languages, neither switch/case nor if/else are actually expressions.

    Branching logic shouldn't be statements, it should be an expression. The branches should be exhaustive and type-compatible.

    Messing around with variable assignments inside/outside logic branches increases the chance of bugs.
Add Comment