I have an enum Pitch and a class Pitch, both naturally to me should be named as such, however it's confusing to have both with the same name. Are there any guidelines for when an enum's name clashes with a class type?
EXAMPLE:
public enum Pitch
{
Fastball,
Sinker,
Curveball
}
public class Pitch
{
}
Name the enum PitchType, PitchKind, PitchMagnitude, PitchQuality, PitchShape, PitchSpeed, PitchStrength or whatever fits best.
Another consideration is whether the class design could be improved. Instead of having a PitchType property inside the class Pitch, you could also create a class hierarchy:
public abstract class Pitch {}
public class Fastball : Pitch {}
public class Sinker : Pitch {}
public class Curveball : Pitch {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With