0

I am fairly new to programming and I have used enumerators mainly for switch statements. When I define them I normally put them in the class/interface file it is mostly related to.

But when I do, I am uncertain whether this belongs in that file or in a separate one. I have looked around the internet but based on the answers given, I feel they are just providing opinions on it without backing it up.

Some say put all your enumerations in one file (but I feel this may be a separation of concerns problem) or group them together into separate files.

I want to know if someone could provide an explanation on where enumerations should be placed BUT base your explanation on common practices such as SOLID or other resources. If you feel this is not possible, then could you please state why.

GIVE-ME-CHICKEN
  • 1,239
  • 3
  • 15
  • 29
  • 7
    I bet in switch statements you have used *enumerations* instead of *enumerators* – Sergey Berezovskiy May 13 '14 at 14:10
  • Can you provide an example of an enumeration and how you are using it? – davisoa May 13 '14 at 14:11
  • 1
    This is indeed mostly opinion or context based. Sometimes an enum makes sense only in one particular class, sometimes it has to exist for all of them. – Kilazur May 13 '14 at 14:12
  • @SergeyBerezovskiy Technically a member of an enumeration *is* an enumerator so, if you are using an enumeration, you are also using at least one enumerator (albeit not what people generally mean when they say "enumerator"). – Ant P May 13 '14 at 14:12

0 Answers0