DEV Community

Discussion on: Stop using if else

Collapse
 
manchicken profile image
Mike Stemle

I love this post. It’s missing a bunch of details, such as how you can use functions instead of strings to match the items, and that this is a contemporary implementation of a “Command Pattern.”

Many of the responses aren’t terribly helpful, and some are a bit on the rude side. We should be more willing to entertain someone else’s ideas than to simply shoot them down as many comments on this post do.

Rishav, your idea could use more fleshing out, but I like where you’re going with this. I would very much like to see you continue on this thought, and address how this pattern can lead to a reduction in cyclomatic complexity and an overall increase in testability of the function implementing this pattern.

Collapse
 
rjitsu profile image
Rishav Jadon

Thanks Michael, yes the comments are filled with useless people just wanting attention. Still thinking about this and surely will provide a better version in the future!

Some comments have been hidden by the post's author - find out more