Can I change the background of the blog?
CFC design -
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > ColdFusion > CFC design - "import" keyword 23 August 2004 23:24:12

  Recent blog posts: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

CFC design - "import" keyword

Nathan Strutz 23 August 2004 23:24:12
 My co-worker is making a shopping cart, trying to keep it fairly CFC
oriented, not necessarily OO to the core, just reliant on CFCs in places
where they would seem useful.

Anyway, we got into a discussion about his cfscript library, which he
turned into a CFC for portability. Now he'd like to use that object in
all of his other CFCs, some scoped to session, some to application, some
to single page requests, etc.

I'm no OO pro, but in Java, we would use the "import" keyword (or
"using" for c sharpies out there). What's the best way to do this
through a CFC?

1) instantiate the cfscript cfc in each component
2) instantiate the cfscript cfc in the application, call
application.cfscrip­t.method() - doesn't sound good, i know, but i'm just
throwing it out there.
3) instantiate the cfscript cfc in the application, pass the reference
in as an argument on init()
4) any other ideas?


thanks
-nathan strutz

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=35

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:175581
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
Barney Boisvert 23 August 2004 23:24:12 permanent link ]
 If the methods are static, use CFINVOKE on the component, rather than
an instance. If they're not static (or you want to call them
non-statically for performance reasons), then I'd instantiate the
class in the constructor of each CFC that uses it and keep it around
in an instance variable. Depending on your situation, it might make
more sense to instantiate per method call, if you're going to be
creating a lot of instances of the calling object, but most of them
won't be using the utility class.

Whether you're using the external CFC is an implementation detail, so
it shouldn't be dependant on the environment (app var or an init
param), at least in my view.

cheers,
barneyb

On Mon, 23 Aug 2004 13:03:38 -0700, Nathan Strutz <nathans-C/evCYVThE­ZBDgjK7y7TUQ@public.­gmane.org> wrote:> My co-worker is making a shopping cart, trying to keep it fairly CFC> oriented, not necessarily OO to the core, just reliant on CFCs in places> where they would seem useful.>
Anyway, we got into a discussion about his cfscript library, which he> turned into a CFC for portability. Now he'd like to use that object in> all of his other CFCs, some scoped to session, some to application, some> to single page requests, etc.>
I'm no OO pro, but in Java, we would use the "import" keyword (or> "using" for c sharpies out there). What's the best way to do this> through a CFC?>
1) instantiate the cfscript cfc in each component> 2) instantiate the cfscript cfc in the application, call> application.cfscrip­t.method() - doesn't sound good, i know, but i'm just> throwing it out there.> 3) instantiate the cfscript cfc in the application, pass the reference> in as an argument on init()> 4) any other ideas?>
thanks> -nathan strutz

--
Barney Boisvert
bboisvert-Re5JQEeQq­e8AvxtiuMwx3w@public­.gmane.org
360.319.6145
http://www.barneyb.­com

~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~~~~~~~~~~~­~~~~~~~~~~|
This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
http://www.houseoff­usion.com/banners/vi­ew.cfm?bannerid=11

Message: http://www.houseoff­usion.com/lists.cfm/­link=i:4:175588
Archives: http://www.houseoff­usion.com/cf_lists/t­hreads.cfm/4
Subscription: http://www.houseoff­usion.com/lists.cfm/­link=s:4
Unsubscribe: http://www.houseoff­usion.com/cf_lists/u­nsubscribe.cfm?user=­13123.11886.4
Donations & Support: http://www.houseoff­usion.com/tiny.cfm/5­4
Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > ColdFusion > CFC design - "import" keyword 23 August 2004 23:24:12

see also:
[Installation, Configuration &…
[Tomcat, HTTPD, Servlets & JSP]…
[Installation, Configuration &…
пройди тесты:
see also:
real ventures
sell electronic such as nokia n95,apple…
prist list of electronic

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .