Suppose I've the following classes in my project:
- class Is // validation class
- class Math // number manipulation class
Now, if I want to validate a given number for primality where would be the logical place to insert my Prime() method? I can think of the following options:
- Is_Math::Prime()
- Math_Is::Prime()
I hate these ambiguities, the slow down my thinking process and often induce me in errors. Some more examples:
- Is::Image() or Image::Is() ?
- Is_Image::PNG() or Image_Is::PNG() ?
- Is_i18n_US::ZipCode() or i18n_Is_US::ZipCode() or i18n_US_Is::ZipCode() ?
In the Image example the first choice makes more sense to me while in the i18n example I prefer the last one. Not having a standard makes me feel like the whole code base is messy.
Is there a holy grail solution for organizing classes? Maybe a different paradigm?