Yep you can, or put into application scope.

The best way we've found is to put them all into an
application.[sitename].componets structure. This does lead to other
issues with inheritance of objects and how things are scoped so isn't
quite as simple as that.

I do think it is worthwhile creating a component to instantiate your
object as a module, this way you can play with different ways to persist
without having to re-write a lot of code.

I.e rather than 

objMath = createObject('component','componentsDemo.compoents.maths');


objMath = objFactory("componentsDemo.compoents.maths");


objFactory could be something like



//check for application.sitename scope
                                path =
"application.#arguments.siteName#";
                                if (not isDefined(path)) {
                                        //add the struct
        
structInsert(application,arguments.siteName,structNew());
                                }
                                //check for
application.sitename.components scope
                                path =
"application.#arguments.siteName#.components";
                                if (not isDefined(path)) {
                                        //add the struct
        
structInsert(application[arguments.siteName],"components",structNew());
                                }
                                
                                //if no components cached then do a
prefetch
                                if
(structIsEmpty(application[arguments.siteName].components)) {
                                        prefetch();
                                }
                        


We have found this method to speed up object instantiation substantially
and gives us the ability to change it if we find a more effective way of
doing it.

Again, would a flash remoting call know session.mathObj exists?

Find an elegant way to get objects persisting in a useable and easy
methodology is something I think you find a lot of CF developers working
towards.

Grant Straker
www.straker.com.au
 



-----Original Message-----
From: Hilary Bridel [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 27, 2003 11:56 AM
To: CFAussie Mailing List
Subject: [cfaussie] Re: Wishlist for CFCs

Can you do something like:
session.mathObj =
createObject("component","componentsDemo.components.maths")


Hilary
--
"Grant Straker" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]



I think Steve has a good point with number 3 regarding object
instantiation.

It was brought up as a keen point at MXDU that there is a lack of
methodologies around building a site using CFC's - lots on how to build
CFC's, just not on how to efficiently instantiate, inherit and persist
them in a site architecture.

We have been doing a lot of modeling and testing around efficient
methodologies and even after 14 months working with CFMX are still
learning, although we are getting closer.

We are beta testing a very efficient CFMX object architecture at the
moment and if it holds up in production I'll write a document ( or put
up a site ) outlining our approach.

In the meantime you could try using script to invoke


<cfscript>
mathObj = createObject("component","componentsDemo.components.maths")
bla = mathObj.Average(numbers= "#numbers#");
Bla2 = mathObj.Calculation(Calculation= "#Calculate#");


// or chain
bla =
createObject("component","componentsDemo.components.maths").Average(numb
ers= "#numbers#")


</cfscript>




Again the issue is that if the object is now required in another part of
your site it needs to be re-created which is not efficient if in the
same user session.

On top of this you also have the issue of how you get efficient object
instantiation if called via the Flash gateway or as a web service.

Many of these things do not become an issue until you have a lot of load
on the server but need to taken into account early in my view.



Grant Straker
www.straker.com.au






-----Original Message-----
From: Steve Onnis [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 27, 2003 2:45 AM
To: CFAussie Mailing List
Subject: [cfaussie] Wishlist for CFCs


I am here by starting a wishlist for CFCs

Here are my few items.

1- Ability to declaire multiple types in the "Type" attribute of the
CFARGUMENT tag.  Either by using multiple tags or using a list within
the
attribute.

2- Ability to dynamicly populate the "ROLES" attribute of the CFFUNCTION
tag.

3- Friendlier CFINVOKE syntax so you dont have to create the object
ovewr
and over for methods in the same CFC.
eg.

<cfinvoke component="componentsDemo.components.maths">
<cfinvokemethod method="Average" returnVar="Bla">
<cfinvokeargument name="Numbers" value="#Numbers#">
</cfinvokemethod>
<cfinvokemethod method="Sum" returnVar="Bla2">
<cfinvokeargument name="Calculation"
value="#Calculate#">
</cfinvokemethod>
</cfinvoke>


I know you can do this by using the CreateObject and <CFOBJECT methods,
but
if they give us these tags to use, maybe they should be a little more
flexible

my 2 cents

Steve Onnis



---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/





---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to