>- see footer for list info -<
The BEST way is a personal subject. I wouldn't PERSONALLY do it that
way, I would use a constuctor method which I always call init(), this
creates all my object property defaults in the variables scope and
returns the object:-

<cffunction name="init" access="public" output="false"
returntype="myObject" hint="This is the pseudo-contructor.">
        <cfscript>
                variables.fName                                 = "Simon";
                variables.sName                                 = "Baynes";
                
                return this;
        </cfscript>
</cffunction>

The return this; returns the object defined in the returntype of the
cffunction. So you can then call it like so:-

variables.oMyObject = createObject("component", "myObject").init();


Then you set your properties with setter methods.

As I said it is personal preference, you can set data before any
cffunction calls but as I said before I am not a fan.

On 10/19/05, dominic watson <[EMAIL PROTECTED]> wrote:
> >- see footer for list info -<
> Yes agreed, I was just a little confused by the fact that properties
> weren't appearing as such in the object browser.
>
> I was looking at some code from a very good article and they were
> setting properties like so:
>
> <cfparam name="my" default="stuctNew()">
> <cfset my.property1 = "">
> <cfset my.property2 = "">
> ...
>
> Is there a good reason for doing this rather than just using the
> variables scope? I would like to be doing things the "best" way possible
> but am finding it hard to find documentation on it.
>
> dom
>
> Simon Baynes wrote:
>
> >>- see footer for list info -<
> >>
> >>
> >You should really use getter and setter methods IMO for returning and
> >modifying object properties. I avoid the THIS scope as it is way too
> >loose for my liking. By using getter and setter methods, your
> >properties will be commented by your corresponding functions.
> >
> >HTH
> >
> >On 10/19/05, dominic watson <[EMAIL PROTECTED]> wrote:
> >
> >
> >>>- see footer for list info -<
> >>>
> >>>
> >>I eventually found the answer. I meant the properties, the objects
> >>variables. You define them either with cfproperty or by setting
> >>variables outside of the methods. The latter does not make them appear
> >>as properties in the component browser, the former does. Unfortunately,
> >>imo, cfproperty only really has use for web services.
> >>
> >>Snake wrote:
> >>
> >>
> >>
> >>>>- see footer for list info -<
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Do u mean the methods ?
> >>>If you us ethe HINTS properly, then the cfc browser should tell you
> >>>everything u need to know.
> >>>
> >>>-----Original Message-----
> >>>From: [EMAIL PROTECTED]
> >>>[mailto:[EMAIL PROTECTED] On Behalf Of dominic watson
> >>>Sent: 18 October 2005 18:35
> >>>To: Coldfusion Development
> >>>Subject: [CF-Dev] cfc Object browser
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>- see footer for list info -<
> >>>>
> >>>>
> >>>>
> >>>>
> >>>The cfc object browser in CFMX is great but it doesn't ever seem to display
> >>>the 'properties' of an object.
> >>>Is there some sort of properties scope for declaring object properties?
> >>>Or is this functionality simply not functional?
> >>>
> >>>Thanks,
> >>>dom
> >>>_______________________________________________
> >>>
> >>>For details on ALL mailing lists and for joining or leaving lists, go to
> >>>http://list.cfdeveloper.co.uk/mailman/listinfo
> >>>
> >>>--
> >>>CFDeveloper Sponsors:-
> >>>
> >>>
> >>>
> >>>
> >>>>- Hosting provided by www.cfmxhosting.co.uk -<
> >>>>- Forum provided by www.fusetalk.com -<
> >>>>- DHTML Menus provided by www.APYCOM.com -<
> >>>>- Lists hosted by www.Gradwell.com -<
> >>>>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> >>>>-<
> >>>>
> >>>>
> >>>>
> >>>>
> >>>_______________________________________________
> >>>
> >>>For details on ALL mailing lists and for joining or leaving lists, go to 
> >>>http://list.cfdeveloper.co.uk/mailman/listinfo
> >>>
> >>>--
> >>>CFDeveloper Sponsors:-
> >>>
> >>>
> >>>
> >>>
> >>>>- Hosting provided by www.cfmxhosting.co.uk -<
> >>>>- Forum provided by www.fusetalk.com -<
> >>>>- DHTML Menus provided by www.APYCOM.com -<
> >>>>- Lists hosted by www.Gradwell.com -<
> >>>>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >>>
> >>_______________________________________________
> >>
> >>For details on ALL mailing lists and for joining or leaving lists, go to 
> >>http://list.cfdeveloper.co.uk/mailman/listinfo
> >>
> >>--
> >>CFDeveloper Sponsors:-
> >>
> >>
> >>>- Hosting provided by www.cfmxhosting.co.uk -<
> >>>- Forum provided by www.fusetalk.com -<
> >>>- DHTML Menus provided by www.APYCOM.com -<
> >>>- Lists hosted by www.Gradwell.com -<
> >>>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
> >>>
> >>>
> >
> >
> >--
> >Simon Baynes
> >www.simonbaynes.com
> >_______________________________________________
> >
> >For details on ALL mailing lists and for joining or leaving lists, go to 
> >http://list.cfdeveloper.co.uk/mailman/listinfo
> >
> >--
> >CFDeveloper Sponsors:-
> >
> >
> >>- Hosting provided by www.cfmxhosting.co.uk -<
> >>- Forum provided by www.fusetalk.com -<
> >>- DHTML Menus provided by www.APYCOM.com -<
> >>- Lists hosted by www.Gradwell.com -<
> >>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
> >>
> >>
> >
> >
> >
>
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to 
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<
>


--
Simon Baynes
www.simonbaynes.com
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to