Hi Andrew,

I'm pretty new to FarCry, so read this with a grain of salt (what an odd
expression).

Depending on how frequently used or extensive these groups are, I'd be
inclined to register the types (or as Tim extrapolated, instances) with a
reference class upon type definition or object instantiation. The tradeoff
is obviously that you'd have an application global variable (or object)
containing a reference to each registered custom type or object (potentially
along with accessor functions). Memory usage may be in issue there?

It's a thought, don't know if it's a useful one ;)

Chris

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Lucas
Sent: Friday, 31 December 2004 2:25 PM
To: FarCry Developers
Subject: [farcry-dev] Re: grouping Types

On 23/12/2004, at 1:40 PM, Andrew Mercer wrote:
> Does anyone know of a way to group a collection of custom types?

Not sure exactly why you'd want to do the above, but a related 
guideline is that if you have custom types that belong together then a 
sensible naming convention should be used.

For example, a myMusic module could have custom type names as such:
myMusicArtist
myMusicTrack
myMusicAlbum

> I would like to be able to say give me all the types that belong to
> group A - which would return a list of object names, eg myTypeA1,
> myTypeA2, myTypeA3. I could then then loop through the list and work
> with all the objects.

This information is pretty darn static, so why not have a 
myMusicUtils.cfc which has a function that returns the names of all the 
types in the myMusic module?

<cffunction name="myMusicTypeNames" returntype="list" hint="Returns the 
custom type names belonging to the myMusic module">
        <cfreturn "myMusicArtist,myMusicTrack,myMusicAlbum" />
</cffunction>

And if you find you are instantiating these things around the place you 
could put this into a function too:

<cffunction name="myMusicTypeInstances" returntype="array" 
hint="Returns an instance of every type belonging to the myMusic 
module">
   <!--- call myMusicTypeNames() and create an instance of each --->
...

> Or maybe I cold have a naming convestion such that the group name is
> in the object name.

See above.

HTH

- tim lucas



---
You are currently subscribed to farcry-dev as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to