>Or... am I just completely misunderstanding/misusing the use of factory
>pattern?
My feeling is that it's just a question of experience. Using a factory to
instantiate your objects has advantages that might not be obvious in the
beginning. At least they weren't obvious to me.
For instance, without a factory you'll wind up with hundreds if not
thousands of places in your codebase with
CreateObject('component','some.path.object') calls, probably scattered in
many files. Suddenly the day arrives when you need to alter the mapping, or
you want to reorganize your CFC's as your app grows into a directory
structure that makes more sense. I can guarantee you that will be a lot
easier to handle, or you'll be a lot more comfortable running a search and
replace to do it, if your object instantiation is encapsulated within a
factory (or several).
Encapsulating object instantiation makes sense, because change tends to
happen there. As they say, "Encapsulate what changes ...". In fact, in my
experience, encapsulating instantiation in a factory helps to allow change.
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of the
email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]