DEV Community

Discussion on: What is your pettiest programming-related opinion?

 
samuraiseoul profile image
Sophie The Lionhart

I mean I think in finite lists they can have some application. Think like cardinal directions(Noth, East, South, West), basically TRUE Enums, absolutely finite ones. They can be useful sometimes in those cases. You could in theory use a strategy pattern or something even then, and be a more robust solution but it could be seen as over-engineering. If you MUST use one or have a case like above, I always like to throw an exception in the default case. If it shouldn't occur and does, I for sure want to know about it, and I don't want something weak like it being logged. I want it to be a mini-crisis.