--

I also don't like if-else especially for complicated conditionals, and switch statements in general become hard to read and maintain quickly.

But I would vomit if the solution is polymorphic classes in a codebase where I worked, and I wouldn't stay there.

Guard clauses with more small, easy-to-understand helper functions -- and/or state machines to make branching logic easy to visualize and understand -- would seem far superior to that nonsense.

--

--

Dr. Derek Austin 🥳
Dr. Derek Austin 🥳

Written by Dr. Derek Austin 🥳

Hi, I'm Doctor Derek! I've been a professional web developer since 2005, and I love writing about programming with JavaScript, TypeScript, React, Next.js & Git.

No responses yet