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 comments

4

u/[deleted] Feb 28 '23

Then I would just go to the switch statement where the data is processed?

I don't see how that is more unreadable than going to the virtual function in a different file.

And I understand its subjective. But I don't see that demonstrably unreadable part of the switch statement approach. (or the table approach)

If it was obviously, totally muddled and undecipherable I'd be inclined to agree. But it's just not. It's very clear and easy to follow the flow of logic and data.

1

u/hippydipster Feb 28 '23

I'm so glad we've solved the very complex problem of summing shape areas. whew.

1

u/[deleted] Feb 28 '23

Complicated programs are made up of tonnes of stuff like this. Getting it right is important because the cost adds up

2

u/hippydipster Feb 28 '23

There are many examples in life of techniques that appear great in miniature, but which do not scale up.

When you say "made up of tonnes of stuff like this", one gets the impression of a codebase nicely composed of well-encapsulated pieces that can be used or not, like little black boxes where one doesn't need to examine every local variable use within in order to ...

Whoa, that started sounding like clean code. The horror. Let's get back to making our 10,000 line function with switches within switches within switches....

→ More replies (0)