Extra query info
Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190781 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? If the query data came straight from a database rather than being a QoQ or something , then I would prefer to do all the calculations in the original SELECT statement, maybe in a stored procedure - is that an option? Nick ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190783 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Michael, I don't know if this will play into it at all, but I seem to remember some people talking about performance hits when you build new queries or add columns/data to existing queries using the query functions in CF. The method of using a CFC to format the data and return a new query object may have bad performance in that realm if what I've heard is true. Also, once you create the CFC as an object, you should be able to make as many calls as you want to it without nearly as much overhead. I have no data to back that up, but from what I've heard, that seems like it'd be the case. If I'm wrong, I'd love to hear about it. John Burns Certified Advanced ColdFusion MX Developer AI-ES Aeronautics, Web Developer -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:29 PM To: CF-Talk Subject: Extra query info Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190784 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Straight from a DB or SP. There are calculation items that can't be done in the query itself which is why that's not an option. If the query data came straight from a database rather than being a QoQ or something , then I would prefer to do all the calculations in the original SELECT statement, maybe in a stored procedure - is that an option? Nick ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190786 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
The performance of a CFC that has been set as an object is very good. I'd have to say extremely good with a 0ms hit on most occasions. As for a performance hit when building/altering queries, I've never heard of one but I'll do some tests to be sure. A query 'object' is just like an array 'object' or structure 'object'. They're all just data collections. On the other hand, a QoQ does have some overhead but that's due to it having a whole query parsing engine and all. Not a lot of overhead in most cases, but it's not as efficient as some things (like struct functions). Michael, I don't know if this will play into it at all, but I seem to remember some people talking about performance hits when you build new queries or add columns/data to existing queries using the query functions in CF. The method of using a CFC to format the data and return a new query object may have bad performance in that realm if what I've heard is true. Also, once you create the CFC as an object, you should be able to make as many calls as you want to it without nearly as much overhead. I have no data to back that up, but from what I've heard, that seems like it'd be the case. If I'm wrong, I'd love to hear about it. John Burns Certified Advanced ColdFusion MX Developer AI-ES Aeronautics, Web Developer -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:29 PM To: CF-Talk Subject: Extra query info Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190789 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Yeah, I'm trying to remember if I heard the overhead issue somewhere on this list or if it was at MAX but whoever said it seemed fairly reliable and they said the overhead was substantial when building the query objects in CF. Let me know if you produce any reliable numbers or if you come up with a clear-cut solution. John Burns Certified Advanced ColdFusion MX Developer AI-ES Aeronautics, Web Developer -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:43 PM To: CF-Talk Subject: RE: Extra query info The performance of a CFC that has been set as an object is very good. I'd have to say extremely good with a 0ms hit on most occasions. As for a performance hit when building/altering queries, I've never heard of one but I'll do some tests to be sure. A query 'object' is just like an array 'object' or structure 'object'. They're all just data collections. On the other hand, a QoQ does have some overhead but that's due to it having a whole query parsing engine and all. Not a lot of overhead in most cases, but it's not as efficient as some things (like struct functions). Michael, I don't know if this will play into it at all, but I seem to remember some people talking about performance hits when you build new queries or add columns/data to existing queries using the query functions in CF. The method of using a CFC to format the data and return a new query object may have bad performance in that realm if what I've heard is true. Also, once you create the CFC as an object, you should be able to make as many calls as you want to it without nearly as much overhead. I have no data to back that up, but from what I've heard, that seems like it'd be the case. If I'm wrong, I'd love to hear about it. John Burns Certified Advanced ColdFusion MX Developer AI-ES Aeronautics, Web Developer -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:29 PM To: CF-Talk Subject: Extra query info Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190806 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Michael, I just wrote some functionality for a government project recently that basically merged two Verity result sets and made a few changes to them at the same time. I found that there was nearly no overhead. Basically one result set had to appear AFTER the other (don't ask). Processing the queries using Q of Q with UNION was quite a bit slower, though it's all anecdotal timing under the bridge at this point... As far as calling a CFC in a loop or sending the whole query to the CFC to be looped over, I couldn't say without testing it both ways, and even then you wouldn't get accurate results unless you load tested. All things being equal, though, it would seem to make the most sense to do whichever way would be most pertinent to the functionality of the app. Will the method be used by any other parts of the program or is it specific to this one process? You might want to create two methods: the public one that takes a query object could call the private method that does the processing on each row. Andy -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:43 PM To: CF-Talk Subject: RE: Extra query info The performance of a CFC that has been set as an object is very good. I'd have to say extremely good with a 0ms hit on most occasions. As for a performance hit when building/altering queries, I've never heard of one but I'll do some tests to be sure. A query 'object' is just like an array 'object' or structure 'object'. They're all just data collections. On the other hand, a QoQ does have some overhead but that's due to it having a whole query parsing engine and all. Not a lot of overhead in most cases, but it's not as efficient as some things (like struct functions). Michael, I don't know if this will play into it at all, but I seem to remember some people talking about performance hits when you build new queries or add columns/data to existing queries using the query functions in CF. The method of using a CFC to format the data and return a new query object may have bad performance in that realm if what I've heard is true. Also, once you create the CFC as an object, you should be able to make as many calls as you want to it without nearly as much overhead. I have no data to back that up, but from what I've heard, that seems like it'd be the case. If I'm wrong, I'd love to hear about it. John Burns Certified Advanced ColdFusion MX Developer AI-ES Aeronautics, Web Developer -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Monday, January 17, 2005 12:29 PM To: CF-Talk Subject: Extra query info Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190816 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Also, have you considered having the database doing the calculations and create the new fields, then it's already for the ColdFusion once the record set it returned. You probably have, but I wanted to throw this out, as it's an under utilized technique. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning ...-Original Message- ...From: Michael Dinowitz [mailto:[EMAIL PROTECTED] ...Sent: Monday, January 17, 2005 9:29 AM ...To: CF-Talk ...Subject: Extra query info ... ...Here's a conceptual question. Lets say you have a query with multiple ...rows ...in it. There is a few calculations that will take place between items in ...a ...row to get some additional values per row (i.e. a discount price, etc.). ...One way of doing this is when outputting the query, you send the specific ...data to a CFC (It's used in multiple places) and get out a structure. ...This ...means that a 20 row query has 20 calls to the CFC. ...Another way of doing it is to pass the whole query to a CFC which will ...then ...loop over the query, do the calculations and then place the results into ...new ...columns within the query. ...The first has a single loop but multiple CFC calls while the second has 2 ...loops (inside the CFC and out) but a single CFC call. ...Which do you prefer? Do you see a problem with either approach? ...Just something that came into my mind while rewriting a few dozen pages ...on ...this ecommerce site. ... ... ... ... ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190819 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Someone mentioned that already and it's not possible in this instance. On the other hand, you are correct that it's an under utilized technique. Care to write up a small paper on it? ;) Also, have you considered having the database doing the calculations and create the new fields, then it's already for the ColdFusion once the record set it returned. You probably have, but I wanted to throw this out, as it's an under utilized technique. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190820 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Not complete against the idea of writing a paper, even though that is not really my thing, IE I have never done it before. It would probable be a week or three before I had the time, but other then that sure, why not. P.S. Why is it not possible? I missed the earlier post. The technique I had in mind has the fields built right in the SQL statement (as apposed to something done directly in the database design). This is not possible in your case? I would not be surprised if it is not possible, just making sure before abandoning the possibility. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning ...-Original Message- ...From: Michael Dinowitz [mailto:[EMAIL PROTECTED] ...Sent: Monday, January 17, 2005 12:06 PM ...To: CF-Talk ...Subject: RE: Extra query info ... ...Someone mentioned that already and it's not possible in this instance. On ...the other hand, you are correct that it's an under utilized technique. ...Care ...to write up a small paper on it? ;) ... ... Also, have you considered having the database doing the calculations ...and ... create the new fields, then it's already for the ColdFusion once the ... record set it returned. ... ... You probably have, but I wanted to throw this out, as it's an under ... utilized technique. ... ... ... ... ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190822 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Not complete against the idea of writing a paper, even though that is not really my thing, IE I have never done it before. It would probable be a week or three before I had the time, but other then that sure, why not. I happen to know an excellent editor who will work with you to craft a piece of art. :) P.S. Why is it not possible? I missed the earlier post. The technique I had in mind has the fields built right in the SQL statement (as apposed to something done directly in the database design). This is not possible in your case? There's outside information and calculations that can't be done in the SQL. The system is crufty as hell and I'm trying to clean some of it up without going crazy. If/When I do a full job on it, I'll be moving code to the DB that should be in the DB. This is one of those systems where hardware (load balancing, ram, etc.) was added where tighter and proper coding could have done the job. I would not be surprised if it is not possible, just making sure before abandoning the possibility. It should be after a full rewrite. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190824 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
If you're using CFCs it would make more sense to create a function that takes a set of data (one row) manipulates it and returns something else. This way the function can be utilized everywhere instead of just for a query. If you're feeding the whole data set to a CFC why not just make an include file... After the initial call of the CFC (assuming it stays in memory) subsequent calls are fast. Adam H On Mon, 17 Jan 2005 12:28:31 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190826 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
Right. That's the first option below. Looks like that's the one to go with. Problem is, it makes the debug look a mile long. :( If you're using CFCs it would make more sense to create a function that takes a set of data (one row) manipulates it and returns something else. This way the function can be utilized everywhere instead of just for a query. If you're feeding the whole data set to a CFC why not just make an include file... After the initial call of the CFC (assuming it stays in memory) subsequent calls are fast. Adam H On Mon, 17 Jan 2005 12:28:31 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: Here's a conceptual question. Lets say you have a query with multiple rows in it. There is a few calculations that will take place between items in a row to get some additional values per row (i.e. a discount price, etc.). One way of doing this is when outputting the query, you send the specific data to a CFC (It's used in multiple places) and get out a structure. This means that a 20 row query has 20 calls to the CFC. Another way of doing it is to pass the whole query to a CFC which will then loop over the query, do the calculations and then place the results into new columns within the query. The first has a single loop but multiple CFC calls while the second has 2 loops (inside the CFC and out) but a single CFC call. Which do you prefer? Do you see a problem with either approach? Just something that came into my mind while rewriting a few dozen pages on this ecommerce site. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190828 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
On Mon, 17 Jan 2005 15:57:41 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: Right. That's the first option below. Looks like that's the one to go with. Problem is, it makes the debug look a mile long. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* Adam H ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190833 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
I pass queries to CFCs all the time when there's a need. I don't see it as making a mockery of CFCs. As for debugging, it's my own state of mind. This site has over 40 includes per page and that number makes me crazy. I like my code tight and clean and this site is no where near that. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190835 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Adam H On Mon, 17 Jan 2005 16:22:30 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I pass queries to CFCs all the time when there's a need. I don't see it as making a mockery of CFCs. As for debugging, it's my own state of mind. This site has over 40 includes per page and that number makes me crazy. I like my code tight and clean and this site is no where near that. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190851 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extra query info
When I do a query it's super tight. It only has the important data that I want to deal with. That being said, when I pass that query it's because I want to work with all the data. As I make more changes to the HoF site and optimize it more under Blackstone, I'll probably change how I do things. But then again, I do some strange things with CFCs. Take a form that posts it's data to a database. The CFC that does the work for that form will not have any arguments. It's assumed that the form scope exists and I test the variables I want inside the CFC before I enter then into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. Actually, the same goes for my logging CFC which assumes that there will be a CGI scope with data for it to use. When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Adam H On Mon, 17 Jan 2005 16:22:30 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I pass queries to CFCs all the time when there's a need. I don't see it as making a mockery of CFCs. As for debugging, it's my own state of mind. This site has over 40 includes per page and that number makes me crazy. I like my code tight and clean and this site is no where near that. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190852 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. yeah it is...i think even Forta's intro to CFCs calls this a no no. But thats more from the standpoint that it hampers reusability. In our enviroment (as whacky as it is) this would be a BIG no no since Form data is replicated to URL data and passed to the same page on subsequent calls. Adam H On Mon, 17 Jan 2005 17:41:21 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: When I do a query it's super tight. It only has the important data that I want to deal with. That being said, when I pass that query it's because I want to work with all the data. As I make more changes to the HoF site and optimize it more under Blackstone, I'll probably change how I do things. But then again, I do some strange things with CFCs. Take a form that posts it's data to a database. The CFC that does the work for that form will not have any arguments. It's assumed that the form scope exists and I test the variables I want inside the CFC before I enter then into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. Actually, the same goes for my logging CFC which assumes that there will be a CGI scope with data for it to use. When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Adam H On Mon, 17 Jan 2005 16:22:30 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I pass queries to CFCs all the time when there's a need. I don't see it as making a mockery of CFCs. As for debugging, it's my own state of mind. This site has over 40 includes per page and that number makes me crazy. I like my code tight and clean and this site is no where near that. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190855 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Forms to CFCs RE: Extra query info
This is where I disagree with the whole OO approach and what people consider no nos. I know that the form processor CFC always processes a form. I know that a form will only be posted as a form, never as an URL. I know that the CFC will only be used in a place where a form will be posted to. Why should I do all the form variable validation outside the CFC that's supposed to handle the form? Why do I have to set a cfinvokeargument to pass a form into the CFC if I know that the form will exist for the CFC if it exists on the page. Everything about that particular CFC says forms, so why do I have to do extra work to use what the CFC was created to handle. A CFC is part of a page environment. Do you pass in application, session and client information to a CFC? No, because you know it exists. Why is it different for Form and/or CGI information? into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. yeah it is...i think even Forta's intro to CFCs calls this a no no. But thats more from the standpoint that it hampers reusability. In our enviroment (as whacky as it is) this would be a BIG no no since Form data is replicated to URL data and passed to the same page on subsequent calls. Adam H But then again, I do some strange things with CFCs. Take a form that posts it's data to a database. The CFC that does the work for that form will not have any arguments. It's assumed that the form scope exists and I test the variables I want inside the CFC before I enter then into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. Actually, the same goes for my logging CFC which assumes that there will be a CGI scope with data for it to use. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190857 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
Actually, you usually DO pass in server, application, session, and client variables into a CFC. Part of encapsulation is isolation from the environment. What if I switch from client to session variables? Do I really want to have to go change every CFC? Same with your form CFCs. Chances are good they'll never be used for anything except form processing, but what if you need to expose a bit of functionality with a web service? Suddenly no more FORM scope. Oof. If you plan ahead and make your CFC just accept a struct parameter (which you can pass the FORM scope as), then you can just pass in your arguments from your web service method invocation, and not have to change anything. cheers, barneyb On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: This is where I disagree with the whole OO approach and what people consider no nos. I know that the form processor CFC always processes a form. I know that a form will only be posted as a form, never as an URL. I know that the CFC will only be used in a place where a form will be posted to. Why should I do all the form variable validation outside the CFC that's supposed to handle the form? Why do I have to set a cfinvokeargument to pass a form into the CFC if I know that the form will exist for the CFC if it exists on the page. Everything about that particular CFC says forms, so why do I have to do extra work to use what the CFC was created to handle. A CFC is part of a page environment. Do you pass in application, session and client information to a CFC? No, because you know it exists. Why is it different for Form and/or CGI information? -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 8 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190860 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: This is where I disagree with the whole OO approach and what people consider no nos. I know that the form processor CFC always processes a form. I know that a form will only be posted as a form, never as an URL. I know that the CFC will only be used in a place where a form will be posted to. Why should I do all the form variable validation outside the CFC that's supposed to handle the form? Whilst a lot of people might think it strange / inappropriate to use a CFC to process a form POST operation, if that's the single job it does, I feel it's OK. However, there are good ways and bad ways to actually implement it... If your form action is formprocessor.cfc?method=handlePost and handlePost() operates on arguments scope, I think that's just fine. If your form action is a .cfm page that invokes a CFC method then, yes, you absolutely should pass the form scope as an argument. Either way, if the CFC has the responsibility of handling the POST data then it should do the validation. It's all about responsibilities and cohesiveness. A CFC is part of a page environment. Do you pass in application, session and client information to a CFC? Yes, unless the CFC is specifically acting as a façade for operations on that scope. I think it's a bit of a stretch to claim that a CFC is acting as a façade for form scope tho'... -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190861 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
I echo what Barney saidbut i also see a valid point in what Micheal is saying i thinkif I have a CFC called form_validator.cfc I should be able to use it on a form...but I think that kinda defeats some of the concepts that CFC are supposed to be used for...its like making a CSS class RedHeader...which yes i am ashamed to say we have IDs like that yes IDs not classes IDs we use IDs more than once...becuase that makes completely good sense ;) Adam H On Mon, 17 Jan 2005 15:19:01 -0800, Barney Boisvert [EMAIL PROTECTED] wrote: Actually, you usually DO pass in server, application, session, and client variables into a CFC. Part of encapsulation is isolation from the environment. What if I switch from client to session variables? Do I really want to have to go change every CFC? Same with your form CFCs. Chances are good they'll never be used for anything except form processing, but what if you need to expose a bit of functionality with a web service? Suddenly no more FORM scope. Oof. If you plan ahead and make your CFC just accept a struct parameter (which you can pass the FORM scope as), then you can just pass in your arguments from your web service method invocation, and not have to change anything. cheers, barneyb On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: This is where I disagree with the whole OO approach and what people consider no nos. I know that the form processor CFC always processes a form. I know that a form will only be posted as a form, never as an URL. I know that the CFC will only be used in a place where a form will be posted to. Why should I do all the form variable validation outside the CFC that's supposed to handle the form? Why do I have to set a cfinvokeargument to pass a form into the CFC if I know that the form will exist for the CFC if it exists on the page. Everything about that particular CFC says forms, so why do I have to do extra work to use what the CFC was created to handle. A CFC is part of a page environment. Do you pass in application, session and client information to a CFC? No, because you know it exists. Why is it different for Form and/or CGI information? -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 8 invites. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190862 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
I think that realistically, there's always a time to break the rules... even if you follow them to the letter 99% of the time. Granted, saying I will ALWAYS pass a query into this CFC is just begging for someone to change the rules. Unless you're writing a query parser for some specfic purpose. Or you're writing your own app for something specific. Or it's not going to matter what language or framework you're working with, you're always going to pass a resultset into a particular instance. It's the flexibility that one gains from OO that makes it valuable. When creating a new class for something that could be passed around as a parameter becomes more work than it's actually worth, I would think then is a good time to play Pass the Query. Whether you pass a query or not isn't really even the issue, as log as there's a well-documented model and/or API for what you've created, and it's flexible enough to do what you need it to. Then again, when I worked in corporate live I was constantly called a cowboy, and man they take that label way too seriously. Laterz, J On Mon, 17 Jan 2005 14:51:56 -0800, Adam Haskell [EMAIL PROTECTED] wrote: into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. yeah it is...i think even Forta's intro to CFCs calls this a no no. But thats more from the standpoint that it hampers reusability. In our enviroment (as whacky as it is) this would be a BIG no no since Form data is replicated to URL data and passed to the same page on subsequent calls. Adam H On Mon, 17 Jan 2005 17:41:21 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: When I do a query it's super tight. It only has the important data that I want to deal with. That being said, when I pass that query it's because I want to work with all the data. As I make more changes to the HoF site and optimize it more under Blackstone, I'll probably change how I do things. But then again, I do some strange things with CFCs. Take a form that posts it's data to a database. The CFC that does the work for that form will not have any arguments. It's assumed that the form scope exists and I test the variables I want inside the CFC before I enter then into the DB. I'm sure that a CFC depending on environmental data (CGI, Form, etc.) rather than explicitly passing that data in is a violation of some rules somewhere. Actually, the same goes for my logging CFC which assumes that there will be a CGI scope with data for it to use. When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Adam H On Mon, 17 Jan 2005 16:22:30 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I pass queries to CFCs all the time when there's a need. I don't see it as making a mockery of CFCs. As for debugging, it's my own state of mind. This site has over 40 includes per page and that number makes me crazy. I like my code tight and clean and this site is no where near that. :( Yes but you will be able to sleep better at night knowing you have not made a complete mokary of CFCs by passing a whole query into it ;) Besides debugging can be turn off ;) Just feel lucky you can use CFCs the company I moved to is still on CF5...*sigh* -- Continuum Media Group LLC Burnsville, MN 55337 http://www.web-relevant.com http://cfobjective.blogspot.com ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190864 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Forms to CFCs RE: Extra query info
I guess I have to see more CFCs. The ones I've seen 'assume' that server, application, session, and client exist and do not have to be passed in. I usually even see request.DSN 'assumed' into the form. In your example (I see what your saying about the form processing CFC) this would fail as no request from a web service. This brings up the question if the overhead of writing and passing all of this data in order to encapsulate is worth it or just being dogmatic? It feels very much like dogma over use to me, but that's me. Actually, you usually DO pass in server, application, session, and client variables into a CFC. Part of encapsulation is isolation from the environment. What if I switch from client to session variables? Do I really want to have to go change every CFC? Same with your form CFCs. Chances are good they'll never be used for anything except form processing, but what if you need to expose a bit of functionality with a web service? Suddenly no more FORM scope. Oof. If you plan ahead and make your CFC just accept a struct parameter (which you can pass the FORM scope as), then you can just pass in your arguments from your web service method invocation, and not have to change anything. cheers, barneyb On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: This is where I disagree with the whole OO approach and what people consider no nos. I know that the form processor CFC always processes a form. I know that a form will only be posted as a form, never as an URL. I know that the CFC will only be used in a place where a form will be posted to. Why should I do all the form variable validation outside the CFC that's supposed to handle the form? Why do I have to set a cfinvokeargument to pass a form into the CFC if I know that the form will exist for the CFC if it exists on the page. Everything about that particular CFC says forms, so why do I have to do extra work to use what the CFC was created to handle. A CFC is part of a page environment. Do you pass in application, session and client information to a CFC? No, because you know it exists. Why is it different for Form and/or CGI information? -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 8 invites. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190865 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
On Mon, 17 Jan 2005 14:30:37 -0800, Adam Haskell [EMAIL PROTECTED] wrote: When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Why are you surprised about this tactic? I pass query objects around in my code all the time: it's perfectly reasonable to return query objects from methods and pass them in as arguments. The query object is, after all, already an encapsulation of the raw data inside it. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190867 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Forms to CFCs RE: Extra query info
I would also like to mention that I have experienced cases where the CFC did not share the same application and session scopes. I have not been able to fully explore how or when I can cause this to happen. But I lost a lot of development time trying to figure out why an application I'm building did not work in parts because of this. -- Ian Skinner Web Programmer BloodSource www.BloodSource.org Sacramento, CA C code. C code run. Run code run. Please! - Cynthia Dunning ...-Original Message- ...From: Michael Dinowitz [mailto:[EMAIL PROTECTED] ...Sent: Monday, January 17, 2005 3:30 PM ...To: CF-Talk ...Subject: RE: Forms to CFCs RE: Extra query info ... ...I guess I have to see more CFCs. The ones I've seen 'assume' that server, ...application, session, and client exist and do not have to be passed in. I ...usually even see request.DSN 'assumed' into the form. In your example (I ...see ...what your saying about the form processing CFC) this would fail as no ...request from a web service. ...This brings up the question if the overhead of writing and passing all of ...this data in order to encapsulate is worth it or just being dogmatic? It ...feels very much like dogma over use to me, but that's me. ... ... Actually, you usually DO pass in server, application, session, and ... client variables into a CFC. Part of encapsulation is isolation from ... the environment. What if I switch from client to session variables? ... Do I really want to have to go change every CFC? ... ... Same with your form CFCs. Chances are good they'll never be used for ... anything except form processing, but what if you need to expose a bit ... of functionality with a web service? Suddenly no more FORM scope. ... Oof. If you plan ahead and make your CFC just accept a struct ... parameter (which you can pass the FORM scope as), then you can just ... pass in your arguments from your web service method invocation, and ... not have to change anything. ... ... cheers, ... barneyb ... ... On Mon, 17 Jan 2005 18:07:50 -0500, Michael Dinowitz ... [EMAIL PROTECTED] wrote: ... This is where I disagree with the whole OO approach and what people ... consider ... no nos. I know that the form processor CFC always processes a form. I ... know ... that a form will only be posted as a form, never as an URL. I know ...that ... the ... CFC will only be used in a place where a form will be posted to. Why ... should ... I do all the form variable validation outside the CFC that's supposed ...to ... handle the form? Why do I have to set a cfinvokeargument to pass a ...form ... into ... the CFC if I know that the form will exist for the CFC if it exists ...on ... the ... page. Everything about that particular CFC says forms, so why do I ...have ... to ... do extra work to use what the CFC was created to handle. ... A CFC is part of a page environment. Do you pass in application, ...session ... and ... client information to a CFC? No, because you know it exists. Why is ...it ... different for Form and/or CGI information? ... ... ... ... -- ... Barney Boisvert ... [EMAIL PROTECTED] ... 360.319.6145 ... http://www.barneyb.com/ ... ... Got Gmail? I have 8 invites. ... ... ... ... ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190870 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
I guess when I think about what I would be doing I can only think of procesing individual rows in the query not doing in processing to the query itself...I can understand returning a query I use that plenty of places... But thats kind of what i am getting at, when it comes to pasing in a query, if I have an object that works at getting data and returning queries why would i not just be passing in the object and not the query? I am not saying its wrong one way is wrong, I am just trying to understand, never had a place where I saw it happening...guess an example is what i am looking for. Adam H On Mon, 17 Jan 2005 15:32:25 -0800, Sean Corfield [EMAIL PROTECTED] wrote: On Mon, 17 Jan 2005 14:30:37 -0800, Adam Haskell [EMAIL PROTECTED] wrote: When do you passa query to a CFC? I would think you would pass an object the has a query set in it maybe but a complete Query? I mean I am sure there are valid reason but none are coming to mind :) Why are you surprised about this tactic? I pass query objects around in my code all the time: it's perfectly reasonable to return query objects from methods and pass them in as arguments. The query object is, after all, already an encapsulation of the raw data inside it. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190871 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
It all boils down to how much you value encapsulation. I think it's worth it, but that's just me. I hate testing code, so the more isolated each bit of code is the better. I also work on constant-development apps, so it's not a build it and let it run type thing, I'm constantly making changes. Consequently, I encapsulate everything I can, and I can tell you it makes things MUCH easier. Your description of CFC use is rather like a CFINCLUDE, from what it sounds like (correct me if I'm wrong). Nothing wrong with that at all, because the two are quite similar, and methods bring the added advantage of scope isolation (one gripe with CFINCLUDE). I prefer to leave that stuff in CFINCLUDEs though, and save the CFCs for tasks that really need them. Again, that's totally personal preference, and undoubtedly heavily biased my use of Fusebox. For example, I have val_.cfm templates that take care of validating a form. They assume the FORM scope (actually 'attributes', but whatever) exists, and blindly use it. I'd never bother wrapping that in a CFC, because the benefits are almost nil for the extra work. cheers, barneyb On Mon, 17 Jan 2005 18:30:25 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I guess I have to see more CFCs. The ones I've seen 'assume' that server, application, session, and client exist and do not have to be passed in. I usually even see request.DSN 'assumed' into the form. In your example (I see what your saying about the form processing CFC) this would fail as no request from a web service. This brings up the question if the overhead of writing and passing all of this data in order to encapsulate is worth it or just being dogmatic? It feels very much like dogma over use to me, but that's me. -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 8 invites. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190872 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
On Mon, 17 Jan 2005 18:30:25 -0500, Michael Dinowitz [EMAIL PROTECTED] wrote: I guess I have to see more CFCs. The ones I've seen 'assume' that server, application, session, and client exist and do not have to be passed in. I would classify those as not good practice. I usually even see request.DSN 'assumed' into the form. Another bit of not good practice. This brings up the question if the overhead of writing and passing all of this data in order to encapsulate is worth it or just being dogmatic? It feels very much like dogma over use to me, but that's me. What overhead? Passing a single argument by reference? That's definitely worth it. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 5 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190873 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extra query info
How about a method that does send a notification to these users. You might pass in an array of user objects, but depending on how the rest of your app is set up, you might well be passing a recordset. You could write also it so that you'd notify each user individually (separate method call), and do the loop over the recordset outside the method, but I personally don't like that approach. Or you might even do both, where the CFC client passes a recordset to a method, and all that method does is a loop and call another method for each row. Really any place you need to pass in multiple things is a candidate for using a recordset. Some places you'll pass in object collections, some places you'll use recordsets. And in any app, you could, based on personal preference, do it all one way or the other, if you so chose. Just different routes to the same end. cheers, barneyb On Mon, 17 Jan 2005 18:43:39 -0500, Adam Haskell [EMAIL PROTECTED] wrote: I guess when I think about what I would be doing I can only think of procesing individual rows in the query not doing in processing to the query itself...I can understand returning a query I use that plenty of places... But thats kind of what i am getting at, when it comes to pasing in a query, if I have an object that works at getting data and returning queries why would i not just be passing in the object and not the query? I am not saying its wrong one way is wrong, I am just trying to understand, never had a place where I saw it happening...guess an example is what i am looking for. Adam H -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 8 invites. ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190875 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Forms to CFCs RE: Extra query info
The more I think about it, the more passing the form scope into the form processing CFC makes sense, as long as there is no overhead for this operation. On the other hand, I can't see a reason to pass the CGI scope into a CFC that's designed to do site logging. It's designed to operate with the environment, not seperate from it. That being said, I've printed up some CFC best practices and will be going over them to see where I may be going wrong. YOu are correct in that I've been using CFCs a bit like modified CFINCLUDES. Now that HoF is on Blackstone, I'll be getting deeper into EVERY aspect of CFCs and making them work best for me. And with my new digital recorder coming (http://www.houseoffusion.com/cf_lists/messages.cfm/threadid:15587/forumid:5), I'll be able to write more on it. :) ~| Logware: a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190876 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54