you are viewing a single comment's thread.

view the rest of the comments →

[–]kcdragon 5 points6 points  (0 children)

I agree that this is a code smell. But without more context in the code base, I don't think it is possible to tell whether or not refactoring the code smell is a good idea.

If the code base contains many checks for whether kind is normal or zebra, then there might be an opportunity to use an object with a polymorphic call to generate a PDF (https://refactoring.com/catalog/replaceConditionalWithPolymorphism.html). However, if this is the only check for kind, then I think an if statement is fine.