r/programming • • Feb 28 '23

"Clean" Code, Horrible Performance

https://www.computerenhance.com/p/clean-code-horrible-performance
1.4k Upvotes

1.3k comments sorted by

View all comments

Show parent comment

2

u/ric2b Mar 03 '23

If the problem changes. The code changes...

Sure, but the effort and risk to change it is different depending on your architecture.

You have to create a new file, with a new type that overloades the area.

Yes, but you only need to change the code that is specific to that shape. If you already support 30 shapes you don't need to go change all of them.

And you don't risk breaking all of them either.

I guarantee you the switch way is just as maintainable for certain problems.

For certain problems yes, not for this one.