The init() method might initialize all the properties and do any other
cleanup necessary to give us a new, empty component; so in this
example perhaps (some tag attributes ommitted because I'm lazy):

<cffunction name="init">
  <!--- clear the name --->
  <cfset VARIABLES.Name = "">
  <cfreturn THIS>
</cffunction>

After this we'd need to call setName().

The other option is to require the name to be part of the constructor:

<cffunction name="init">
  <cfargument name="name">
  <!--- set the name, by calling the setname method so we can check
for validity etc --->
  <cfset setName(ARGUMENTS.name)>
  <cfreturn THIS>
</cffunction>

in both cases, setName() and getName() might be:

<cffunction name="setName">
  <cfargument name="name" type="string">
  <!--- any other input checking you need here --->
  <cfset VARIABLES.name = ARGUMENTS.name>
</cffunction>

<cffunction name="getName">
  <!--- this could be much more
  complicated than this if necessary,
  doing conversions,
  security checks etc etc --->
  <cfreturn VARIABLES.name>
</cffunction>

Finally, insertJob():

<cffunction name="insertJob">
  <!--- get the name property via the method,
  so our security checking or whatever else
  we did happens here too --->
  <cfset var thisThingsName = getName()>
  <cfquery ....>
    INSERT INTO blah blah
    blah blah <cfqueryparam cfsqltype="cf_sql_varchar"
value="#thisThingsName #">
  </cfquery>
</cffunction>

Keep reading the references, there are people with far more OO
experience than I who will have better examples and better rules to
follow.

On 2/17/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> Thank you James,
>
> I think I might climb out of this one. Things are still a bit ethereal
> in my mind but I think I am begining to grasp it much more now. I
> would like to see a mock-up of the code inside the component using
> srategy number 2.
[snip]

--
CFAJAX docs and other useful articles:
http://jr-holmes.coldfusionjournal.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232670
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to