Janet,

"Controller" is a pretty generic term for the code that first gets control
when the page loads and then works out what to do next.  Generally a
controller will do something like:

1. Gathers/detects user inputs and/or actions (e.g. user clicked on a link,
user typed some text into a form field and hit submit)
2. Modifies the systems state based on what the user did (e.g. updates
breadcrumb nav data, inserts something into a database)
3. Works out what the user should see next and sends them there (e.g.
redirects to a thank you page, calls a display module to redisplay a form)

You can implement this any number of ways, but there are some general
principles that apply to all well-behaved controller code:

1. Don't put the code in the page - at least put it in a module if not a
CFC.
2. Don't directly manipulate the database or other system state.  The
controller should call another a set of modules and/or CFCs (aka "the
model")  to do this.
3. Don't directly display anything.  Once again,the controller should call
another set of modules and/or CFCs (aka "the view") to do this

Once you've separated out all the model and view code, the remaining
controller code can be very simple.  It's really just dealing with
application flow.
.
Jaime
  -----Original Message-----
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of J MacKay
  Sent: Friday, 30 March 2007 8:48 AM
  To: [email protected]
  Subject: RE: [CFCDEV] newbie: needs an opinion on component structure


  Jaime,

  Yes, I think I was trying to make the DAO smarter than it needed to be.

  I've been focusing on the persistence aspect and the lower level stuff.
Honestly, I'm not sure I understand controllers. Can you explain a bit more?
Do I need a controller here?

  Janet



  --


----------------------------------------------------------------------------
--
  Don't pick lemons.
  See all the new 2007 cars at Yahoo! Autos.
  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]


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]

Reply via email to