News for hackers. Stuff that matters.
Re:There’s No Such Thing as Clean Code by fortylove on Friday January 28, 2022 @03:54AM (#30112261)
Is that view not subjective though? Might someone think that if/else is simpler?
Re:There’s No Such Thing as Clean Code by qayxc on Friday January 28, 2022 @06:33AM (#30113373)
Depends entirely on the metric used.

Cyclomatic complexity would put if/else behind polymorphism while using lines of code and depth of inheritance would favour the if/else way.

That's the crux with software - there's not always an objectively better solution in terms readability/comprehensibility and some metrics that try to capture these qualities are inherently at odds with each other.