I haven't used fusebox but have been using Mach-II with Coldspring..
Would not recommend option 1 - you are just creating dependencies on the
request scope. Could get messy in the future.
ColdSpring keeps all the instances of your beans in memory so aliasing
these to the request scope seems redundant - you might as well just
reference the application.beanFactory wherever you need it instead.
Again, not recommended.
Would recommend option 2 *but* would warn against making beans available
to the views. You should make all your calls against the beans in your
controller and then pass the results through to the view.
MVC's are about reducing dependencies and so is ColdSpring so keep that
in mind when implementing all this.
On Thu, 2008-06-19 at 09:40 +1000, Adam Chapman wrote:
> 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---