I hate to say... Being a newbie at CFC's and all, there is a lot of mention
of stateful CFC's etc... Ways of avoiding it and encapsulation etc...
Anyone care to explain these to a humble newbie like me please?
A stateful instance remembers information between invocations of methods:
<cfset stateful = createObject("component","foo") />
...
<cfset stateful.remember("some data") />
...
<cfset memory = stateful.reminder() />
... memory is "some data" ...And inside the CFC you use either "this" scope or the unnamed scope to store the data (the latter is better practice):
<cfcomponent>
<cffunction name="remember">
<cfargument name="info">
<cfset my_data = arguments.info>
</cffunction>
<cffunction name="reminder" returntype="any">
<cfreturn my_data>
</cffunction>
</cfcomponent>Stateful CFCs therefore have a notion of 'history' - the behavior and result of a method call is often dependent on the sequence of method calls that have already been made to that instance.
A stateless CFC doesn't store information, it provides services. The behavior and result of a method call does not depend on the sequence of method calls that have already been made to that instance (caveat: if the methods access external 'state', such as a database, then clearly there is a history but it's database history and not a history of the component itself).
HTH, 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 word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
