i am making an object-oriented app in coldfusion, and so i have really broken down the code. so, i have really long namespaces for my components; for example:
folder1.folder2.plugin1.datatypes.Object
i seem to be repeating a lot of stuff, but at the same time, some of these things are acting like “modules”. what i mean by this is that “folder2” in the example really contains, for lack of a better term, “stand-alone” components/applications (think of them like plugins). so, aside from them calling other plugins’ resources, they act on their own. but, due to the folder structure, i still have to refer to them all as folder1.folder2…. and so on.
so, let us assume that the “folder1.folder2.” could change on a whim. (this will not happen, but since “plugin1” would define a stand-alone component, it does not care what “folder1” or “folder2” contains, if they even exist).
when i am writing code within the plugin, is there anyway i can shorten the namespace string; is there such a thing as “relative” namespaceing, just like using relative href links?
such a thing would save me a lot of time, but would also help ensure these things are more stand-alone as they would not be tied to their encapsulating folder structure…
You could use ColdFusion mappings, specifically per-application mappings in Application.cfc.
You do this in Application.cfc
The you could reference components by doing com.datatypes.object.
Cannot recall when per-app mappings came about, but its been there for a few releases.