4 ms·
I don't understand the issue with the switch statement at the beginning. It's said that it "isn't great from a flexibility point of view" and "is more or less
by throwaway34241 7y ago
I don't understand the issue with the switch statement at the beginning. It's said that it "isn't great from a flexibility point of view" and "is more or less guaranteed to grow out of control".
In the hypothetical example of a note taking app, what bad thing would happen by keeping the switch statement? Adding two lines to a switch statement seems like a trivial step
compared to all the other work required to write an importer for something like markdown.
The switch statement is trivially easy to read and understand, more so IMO than replacing it with a FileImportResult enum, a generic FileImporter class, creating static factory methods for each import category, etc. I'd like to understand the benefits of programming in that style over something more simple.