naming collisions

Monkey Forums/Monkey Programming/naming collisions

dmaz(Posted 2011) [#1]
I know how to create modules and how to use module paths and so on and so forth... the problem is that in my current framework I found it easier to just use a short 2 character preface (representing the mod name) on the front of all classes.

What are any thoughts on this... how much do people hate this or love this:) ? should I re-factor and be happy with mod scope and use mod paths instead?

as for myself, I believe I should use mod paths but I find it so much more readable when it's clear what module/s the class is from. at the same time a longer path that would result from mod pathing seems like overkill.

for instance, currently I might have:
Field pac:ugPac
Field font:ugPacImage
Field x:ugFloat

going with mod paths could look like this:
Field pac:ugge.Pac
Field font:ugge.PacImage
Field x:ugge.Float

or even because the first 2 shouldn't clash:
Field pac:Pac
Field font:PacImage
Field x:ugge.Float

and what about this:
Class MyApp Extends App Implements ugge.EventHandler

I think I like this better
Class MyApp Extends App Implements ugEventHandler


Gerry Quinn(Posted 2011) [#2]
I think perhaps it depends on the size of the module. If there are loads of classes, then I can see the benefit of a prefix. If there are just a few, then I think I would prefer just a simple name which probably wouldn't even need the mod path.


MikeHart(Posted 2011) [#3]
I would go with the prefix when you have a name clash and without the mod path. So something like a mix of solution 1 + 3.


dmaz(Posted 2011) [#4]
that works for current clashes that I know about but there will be others as I or other users start to use more modules...