On Feb 18, 2004, at 1:29 AM, Thomas Chiverton wrote:
Has anyone done any work (or thought) about solving problems with loading a
large number of co-dependant packages into the session scope ?
For instance, session.user might use session.authFactory, so you have to
create session.authFactory first.

My initial reaction is: don't have the user object depending on a session scope variable! Having CFCs that depend on their environment introduces coupling (between the CFC and its environment) and leads to exactly the problem that you are seeing. You can reduce the coupling by either passing session.authFactory into session.user's methods as needed or passing session.authFactory into session.user's init() method (which then stores the reference in "variables" scope).


However, if you decide to keep the dependencies, why not just rely on 'lazy initialization' (aka 'initialize on demand') and have session.user create session.authFactory if it isn't present?

My first thought was to have each CFC export a list of requires and depends,
and have a 'loader' CFC that sorted it all out.

Revisit your design and see if you can actually remove some of the dependencies and reduce the coupling between your components.


Perhaps you could turn authFactory into a stateless component - a service component - and create one instance at startup and place it in application scope? Then when you create your session.user component, pass application.authFactory into the constructor (init()).

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' in the message of the email.


CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to