Search code examples
actionscript-3oopcoding-styleconventions

Is it bad to prefix all of my framework class names?


I develop a lot of frameworks for Flash games and applications. I have always prefixed my class names with a random character or two, to avoid conflict with class names that the developer may already have, for example:

class LEntity

Recently I had a co-worker blast me for poor and "annoying" naming of classes who then proceeded to rename every class in the frameworks I've created for people here to use.

I'm having trouble explaining my reasoning thoroughly enough for him to accept what I've done as a good approach.

Is what I've done above actually a bad thing? If not, how can I explain otherwise? If so, why?


Comments are asking about namespaces - I know AS3 in this example has what I know to be called a namespace but I'm not sure if this is the same thing or if it can be used as expected.


Solution

  • Given that Actionscript supports namespaces, there is no reason to use prefixes simply to prevent naming clashes. That's what namespaces are for.

    Some people like to use namespaces to significy member variables (ie, underscore prefix, or sometimes m_) and that has some merit, but simply for the sake of name clashing no.