How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Hi, all... still trying to get a handle on using CFC's. Here's an update method I wrote and I'd like to know what can be changed to make it better. Such as, why not use the form scope in the query? And, why not just use the application scope for the dsn, instead of converting it to the

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
be put on someone's do-not-hire list because they are sticklers for things such as this. ;^) Mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 9:10 AM To: cf-talk Subject: How can this CFC be improved? Hi, all... still trying to get

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
you need to store the product_id for the lifetime of the component's instance.) mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 9:10 AM To: cf-talk Subject: How can this CFC be improved? Hi, all... still trying to get a handle

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
I generally make my CFCs as generic as possible. You are updating a product and looking in the form scope for everything. It'll work, sure. But, what if in the future you get an entire cart. Then you won't be looking in the form scope, you'll be looking at something in the session or

RE: How can this CFC be improved?

2008-10-22 Thread Jim Davis
-Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 10:10 AM To: cf-talk Subject: How can this CFC be improved? Hi, all... still trying to get a handle on using CFC's. Here's an update method I wrote and I'd like to know what can

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
for things such as this. ;^) Mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 9:10 AM To: cf-talk Subject: How can this CFC be improved? Hi, all... still trying to get a handle on using CFC's. Here's an update method I wrote

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
the lifetime of the component's instance Such as, if the variable is going to be used in other methods before returning data to the calling page? Dawson, Michael wrote: Couple others suggestions... You need to VAR your query: In your cffunction tag right after the cfargument tag, add:

Re: How can this CFC be improved?

2008-10-22 Thread Rob Parkhill
may be put on someone's do-not-hire list because they are sticklers for things such as this. ;^) Mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 9:10 AM To: cf-talk Subject: How can this CFC be improved? Hi, all

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Thanks for the feedback, Jake. All that reassigning of variables is a lot more typing. (But, can I get around reassigning each form variable individually by using the argumentCollection attribute when calling the method?) I think I see what you're saying, however. By translating the type of

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
10:15 AM To: cf-talk Subject: Re: How can this CFC be improved? Thanks for the feedback, Mike. Even though it works, it is not a normal practice for the guts of a component to know what is going on outside. What's the difference, ultimately, in referring to the form variables in cfset

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
Correct. -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 10:19 AM To: cf-talk Subject: Re: How can this CFC be improved? the lifetime of the component's instance Such as, if the variable is going to be used in other methods

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
I think I'm beginning to understand your reasoning. It's just taking some time for me to get to the best practices of CFC usage. Trying to get anything to work at first keeps my projects moving, while beginning to employ different coding techniques. I'm basically trying to learn by writing code

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Good...maybe I'll catch on before the next decade rolls around... Jake Churchill wrote: Right!. Your call (if you are using the form scope) would look like this: object.update_product(argumentCollection=form); or object.update_product(duplicate(form)); Same thing if you are looking at

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
Using CFCs as function collections like you are doing is the easy part. Wait till you start creating a true OO backend. I'm working on my first right now and I thought I was really good at CFCs until I started this... No pain no gain though, right? Rick Faircloth wrote: Good...maybe I'll

Re: How can this CFC be improved?

2008-10-22 Thread Jake Churchill
Right!. Your call (if you are using the form scope) would look like this: object.update_product(argumentCollection=form); or object.update_product(duplicate(form)); Same thing if you are looking at something in the session: object.update_product(argumentCollection=session.key); Rick Faircloth

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Gotcha... thanks. Charlie Griefer wrote: even if you're a solo developer, creating components that are truly black-boxed (e.g. they know nothing of the world outside them), you're creating components that you can potentially reuse yourself. Also, by passing in the information explicitly

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
No pain no gain though, right? As long as whatever is causing the pain doesn't kill you! :o) Rick Using CFCs as function collections like you are doing is the easy part. Wait till you start creating a true OO backend. I'm working on my first right now and I thought I was really good

Re: How can this CFC be improved?

2008-10-22 Thread Charlie Griefer
even if you're a solo developer, creating components that are truly black-boxed (e.g. they know nothing of the world outside them), you're creating components that you can potentially reuse yourself. Also, by passing in the information explicitly (rather than referring to outside scopes from

Re: How can this CFC be improved?

2008-10-22 Thread Mike Kear
Rick, imagine how it would be if (as is fairly common) you have business objects (beans) handling single items, and DAO cfcs handling all the database interaction back and forth.This is the scenario i drew in the tutorials I wrote ... So in the application scope you have a DAO - just one .

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
could move specific logic from the main .cfm. It took a couple of iterations, but it works fine and it's easy enough to maintain. Mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 10:39 AM To: cf-talk Subject: Re: How can this CFC

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Thanks for the overview, Mike. I see what everyone's saying about the encapsulation. I'm just trying to make all the pieces of the puzzle fit. Your tutorial was helpful. It was a little advanced in some respects. I just needed to approach the CFC's a little more carefully, until I could

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Sounds like a good approach. I'm about to duplicate much of the work I've done on a recent project for another client and I plan to use CFC's instead of putting the code into my .cfm's. (I wouldn't call what I'm going to do OOP... :oP) But since I've already written the code procedurally once,

Re: How can this CFC be improved?

2008-10-22 Thread Charlie Griefer
For now I probably wouldn't worry about DAOs and other related concepts. Build a strong foundation by encapsulating the CFC methods so that they don't rely on any external variables. That'd be a good start. Once you recoil in terror at seeing a CFC method reference application or session or form

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
I think I can handle that approach and stay sane! :o) Charlie Griefer wrote: For now I probably wouldn't worry about DAOs and other related concepts. Build a strong foundation by encapsulating the CFC methods so that they don't rely on any external variables. That'd be a good start. Once

RE: How can this CFC be improved?

2008-10-22 Thread Dawson, Michael
Oh, and VAR your variables!!! If you don't, Ray Camden will be knocking at your door. Mike -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 22, 2008 1:26 PM To: cf-talk Subject: Re: How can this CFC be improved? I think I can handle

Re: How can this CFC be improved?

2008-10-22 Thread Rick Faircloth
Now *that* would be scary this close to Halloween! :oP Dawson, Michael wrote: Oh, and VAR your variables!!! If you don't, Ray Camden will be knocking at your door. Mike ~| Adobe® ColdFusion® 8 software 8 is the most