Hi All,

 

I have started implementing Coldspring into an app I'm working on and I
was after some opinions on the best way to call the beans.

This is a fusebox 5.5 (noXml) implementation.

 

My main aim is to avoid lots of 'unnecessary' code but keeping
performance at a maximum.

 

I think I have 2 primary options.. (Pros & cons as I see them..)

 

1. Set all coldspring beans into local variable scope on every request
in application.cfc

       <!--- application.cfc --->

<cfset thisService = application.beanFactory.getBean("thisService") />

      <cfset thatService =
application.beanFactory.getBean("thatService") />

       ... 20+ beans

       

       Pros: Ease of maintenance, results in shorter syntax

       Cons: Possible performance hit

       

       

2. Set only the beans needed for the request in the controller and also
make it available to the view templates

      <!--- controller --->

      <cfset var thisService =
application.beanFactory.getBean("thisService") />

      <cfset var thatService =
application.beanFactory.getBean("thatService") />

      <cfset event.setValue("myQuery",thisService.myMethod()) />

      <cfset event.setValue("thatService",thatService)) />

      

      <!--- view --->

      <cfset myQuery = event.getValue("myQuery") />

      <cfloop query="myQuery">

            #thatService.formatMe(myQuery.column)#

      </cfloop>

            

      Pros: All beans not copied to local variables scope every request

      Cons: More code to do the same job as scenario 1

 

Any comments appreciated.

 

Regards,

Adam


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to