Hacker News new | ask | show | jobs
by tacitusarc 414 days ago
I sort of agree. I think that rather than develop that skill, many programmers just don’t care and add another “if”. The default I’ve seen is not a forest of classes but a warren of conditional logic.

Conditional logic falls into 3 categories, more or less:

1. Algorithms 2. Validation 3. Type replacements

It’s the third that is most common, and always “wrong”. Sometimes it’s better to keep conditional logic rather than try and figure out the correct type modeling. But most often, the programmer reaching for “if” isn’t even aware of what they are doing. They have a hammer, and everything looks like a nail.