> -----Original Message-----
> From: Mike Soultanian [mailto:[EMAIL PROTECTED]
> Sent: Friday, October 21, 2005 2:00 PM
> To: CF-Talk
> Subject: don't understand CFC package notation
>
> Ok, I'm at a loss as to why people use this notation, or moreso, the
> directory structure. From the examples in books I've read, it's
> suggested that you take the domain name and use that.
Generally I don't recommend this as most shared hosts restrict the use of
the "com" mapping. You won't be able to use such a mapping on many shared
hosts.
Personally I use "cfc_DepressedPress" ("DepressedPress" being the name of
the company) but you can really use anything you like.
> So, let's say I have example.com, I'd put my cfcs in webroot/com and
> then let's say I instantiated my object and am doing a "return this" in
> my init(), my return type would be "example.com.objectname".
In most cases it's the reverse of the domain name:
com.company.library.object
If you could make the "Com" mapping this would ensure uniqueness across
multiple vendors and libraries.
> What if I was using mikeisawesome.tv. Am I going to stick all my CFCs
> in the folder webroot/tv and use "mikeisawesome.tv.objectname" as the
> return type?
No, to follow this recommendation you'd make a "tv/mikeisawesome" folder and
put your CFCs or your libraries in there. The CFC name would then be
"tv.mikeisawesome.object" (an exact mirror of the directory using dots
instead of slashes). You'd need to make a CF mapping to the "tv" folder for
all of this to work.
> What's the logic behind this? I'd really like to know!
The idea is to enforce unique naming amongst vendors and began, I believe,
in the Java world.
Let's say both my company, "SuperWidgets.com", and a competitor,
"SuperiorWidgets.com" are building a component. Unfortunately we've both
settled on the name "SupWidget" for our component. However the components
actually do slightly different things so it turns out that many customers
want to install both for use.
If we both just used "SupWidget" the customers couldn't do it easily (if at
all). However we both followed Java's conventions so the customers can
easily create this folder structure:
- com
- SuperiorWidgets
- SupWidget.class/cfc
- SuperWidgets
- SupWidget.class/cfc
The names of the components (use for validation and so forth) would be:
com.SuperiorWidgets.SupWidget
com.SuperWidgets.SupWidget
And thus we eliminate any potential naming conflicts. The core thought
being since domain names are unique no two companies will conflict and
within a single company they should be able to manage any conflicts
themselves.
I can also say that in a VERY big company this doesn't always work... we've
already had two cases of people using the right domain name but creating
conflicting library names within the company.
So the solution is far from perfect, but it does work well in the Java
World. In CF it's less applicable however due to the prevalence of shared
hosting on a single CF instance since mappings are needed to implement the
naming convetion.
Jim Davis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221844
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54