I'm creating a few cfcs to handle file uploading in an MX6.1 application and
would like some opinions. Here is an outline of the process:
A site user uploads a document. The file is saved to a directory on the server.
A record is added to a database table with the file location and a few other
details. Whenever a document is uploaded, information is written to a history
table and an email is sent to a few other users (The last step is a bit more
complex, but thats the basic idea).
I was thinking I should have at least 3 components (and maybe a manager
component as well?).
FileHandler.cfc - Handle file system operations (ie. upload)
ActionHandler.cfc - Create history record and send emails
DocumentDAO.cfc - Create new document record (ie. CRUD operations)
DocumentDAO would contain a reference to a FileHandler and ActionHandler
instance. So the DocumentDAO component wouldn't have to know anything about
uploads or sending emails. It would simply call a method in FileHandler or
ActionHandler. Something like this
<cffunction name="create"..>
<cfset variables.fileHandler.upload(...)>
<cfquery ..> INSERT INTO Documents ...</cfquery>
<cfset variables.actionHandler.documentCreated(...)>
</cffunction>
I'm not sure if I'm on the right track with this. So I would appreciate any
opinions. Hopefully the description wasn't too murky.
Janet
-------
Still trying to wrap my brain around this OO stuff .. so speak slowly ;)
---------------------------------
Finding fabulous fares is fun.
Let Yahoo! FareChase search your favorite travel sites to find flight and hotel
bargains.
You are subscribed to cfcdev. To unsubscribe, please follow the instructions at
http://www.cfczone.org/listserv.cfm
CFCDev is supported by:
Katapult Media, Inc.
We are cool code geeks looking for fun projects to rock!
www.katapultmedia.com
An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]