RE: Which code reuse method?

2010-05-13 Thread DURETTE, STEVEN J (ATTASIAIT)


I think components still make the most reusable choice for things like
this.
I throw all my utility type functions into one cfc and call the correct
function according to what is required, even if no input is required it
still has the desired affect of doing xyz. These don't change often so I
normally put them in the application scope



Then just call the required function when needed.

Hi visitor, the phrase of the day is
#application.utilities.phraseOfDay()#


That might make sense for some things, but if you don't have enough of
these items to justify a cfc then it's overkill. Also, what if it is
something that isn't used everywhere or very often? Then you have the
code taking up space in memory that is rarely used.  CFCs and custom
tags both have their place. I believe that in this case the custom tag
is the better bet.  

There are also other advantages to custom tags. When our group creates a
custom tag for our use, generally one of us also generates the changes
for cfeclipse/homesite 5.5+/etc so those custom tags are actually
recognized by the ide and can provide help/tag insight.  Not so easy
with a cfc (as far as I know, I could be wrong).

Steve


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333647
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Which code reuse method?

2010-05-13 Thread DURETTE, STEVEN J (ATTASIAIT)

Shannon,

In some ways you are right, but for code reuse I still believe the
custom tag is the way to go.

Say you put the code in /webroot/myIncludes/myReusableCode.cfm.
Someone working in /webroot/Application1/SubApp1/report would have to
use either 
or  if
the /webroot is mapped correctly.

Using the custom tag method you can put in  and it
works even if you move the cfm files that reference that tag.  If you
use the ../.. method however when you move files around, each file would
then have to be edited. The mapping method would still work.  Another
advantage of using this method is if they needed to override your custom
tag with one similar all they have to do is create a file of the same
name in the current directory.

Also, it's not hard at all to add a directory to use as custom tags. You
make the directory and tell them to add it to the list of directories to
search. For the administrators, that's just a few characters typed into
a field in the CF Administrator. Very simple.

Steve

-Original Message-
From: Shannon Rhodes [mailto:shan...@rhodesedge.com] 
Sent: Thursday, May 13, 2010 10:54 AM
To: cf-talk
Subject: Re: Which code reuse method?



I somewhat disagree.  The easiest way to deal with a straightforward
code snippet that takes no input parameters is a simple cfinclude.  I
can copy/paste the code directly from the page for which it was
originally written, and then done.  With a custom tag, there is a tiny
bit extra to consider (scope issues are different, handling the lack of
an end tag).  It's not that it's a big deal, I'm just wondering what the
advantage would be.  In this case, the advantage may well be simply the
need to demonstrate code reuse to other developers who may use includes
inappropriately---that is a compelling case.


I'm unclear here...developers do not have access to the Administrator
(only management), so I guess I'd need to make the case that they need
to create a custom tags folder for us?

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-13 Thread Casey Dougall

On Thu, May 13, 2010 at 10:54 AM, Shannon Rhodes wrote:

>
> Custom tag is just that:  a bit of code that can be called in a
> single tag,
> that's all.  Nothing 'overkill' about it to implement for a simple
> computation.   environment="development" /> seems fairly straightforward.
>
> I somewhat disagree.  The easiest way to deal with a straightforward code
> snippet that takes no input parameters is a simple cfinclude.  I can
> copy/paste the code directly from the page for which it was originally
> written, and then done.  With a custom tag, there is a tiny bit extra to
> consider (scope issues are different, handling the lack of an end tag).
>  It's not that it's a big deal, I'm just wondering what the advantage would
> be.  In this case, the advantage may well be simply the need to demonstrate
> code reuse to other developers who may use includes inappropriately---that
> is a compelling case.
>
> If that is the case, I would recommend making it a custom tag and
> sticking
> it in the custom tags folder in the CF admin.That way it is avalible to
> everyone with out having to deal with mappings and all that.
>
> I'm unclear here...developers do not have access to the Administrator (only
> management), so I guess I'd need to make the case that they need to create a
> custom tags folder for us?
>
>
>
I think components still make the most reusable choice for things like this.
I throw all my utility type functions into one cfc and call the correct
function according to what is required, even if no input is required it
still has the desired affect of doing xyz. These don't change often so I
normally put them in the application scope



Then just call the required function when needed.

Hi visitor, the phrase of the day is
#application.utilities.phraseOfDay()#


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333645
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-13 Thread Shannon Rhodes

Custom tag is just that:  a bit of code that can be called in a single 
tag, 
that's all.  Nothing 'overkill' about it to implement for a simple 
computation.   seems fairly straightforward.

I somewhat disagree.  The easiest way to deal with a straightforward code 
snippet that takes no input parameters is a simple cfinclude.  I can copy/paste 
the code directly from the page for which it was originally written, and then 
done.  With a custom tag, there is a tiny bit extra to consider (scope issues 
are different, handling the lack of an end tag).  It's not that it's a big 
deal, I'm just wondering what the advantage would be.  In this case, the 
advantage may well be simply the need to demonstrate code reuse to other 
developers who may use includes inappropriately---that is a compelling case.

If that is the case, I would recommend making it a custom tag and sticking
it in the custom tags folder in the CF admin.That way it is avalible to
everyone with out having to deal with mappings and all that.

I'm unclear here...developers do not have access to the Administrator (only 
management), so I guess I'd need to make the case that they need to create a 
custom tags folder for us?


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333644
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Which code reuse method?

2010-05-11 Thread LRS Scout

The two I would look at and use as it makes sense would be either to create
it as a custom tag someplace everyone can get to it (cfmodule calls work too
here) or make it as an application scoped udf that gets included
onapplicationstart.

We have a ton of udfs that are included once and used al over the place.

A cfc does seem to be going overboard to me.  I like the UDF Idea
personally.

-Original Message-
From: Shannon Rhodes [mailto:shan...@rhodesedge.com] 
Sent: Tuesday, May 11, 2010 10:56 AM
To: cf-talk
Subject: Which code reuse method?


I'm probably overthinking this, but I have a really simple snippet of code
that I want to make easily available to other developers in-house.  It takes
no input variables; all it does is figure out the correct link to reporting
services based on the server environment (dev/QA/prod).

Given the simplicity, should this just be an include?  Or at most a UDF
(though I fail to see the point there, since you have to include those too,
and I'm not taking input parameters).  Definitely a custom tag or a cfc seem
like overkill.

However, my secondary concern is that we do not have a process for sharing
code in-house so I could see whatever method I choose turning into a sort of
default method of code reuse (even when not appropriate).  Also, I'm
thinking if I'm really going to approach this properly I need to request a
mapping to a folder above the web root rather than simply throwing in a new
folder and calling it "cfincludes".  Mappings always turn into a PITA around
here, but I want to do this right.

Advice for getting this team moving in the right direction (noting I am not
in management here)?  Thanks! 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333584
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-11 Thread Shannon Rhodes

Great tips, thanks all! 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333583
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


RE: Which code reuse method?

2010-05-11 Thread DURETTE, STEVEN J (ATTASIAIT)

If your custom tag doesn't surround anything, make sure you add this
line:



That way if you have programmers that self close tags (), it won't run twice.

Steve

-Original Message-
From: Jason Fisher [mailto:ja...@wanax.com] 
Sent: Tuesday, May 11, 2010 12:32 PM
To: cf-talk
Subject: Re: Which code reuse method?


+1 to making it a custom tag in the server's default custom tag
directory.  



> Definitely a custom tag or a
cfc seem like overkill.

Custom tag is just that:  a bit of code that can be called in a single
tag, 
that's all.  Nothing 'overkill' about it to implement for a simple 
computation.   seems fairly straightforward.



From: "Gerald Guido" 
Sent: Tuesday, May 11, 2010 11:18 AM
To: "cf-talk" 
Subject: Re: Which code reuse method?

>>However, my secondary concern is that we do not have a process for 
sharing
code in-house so I could see whatever method I choose turning into a
sort 
of
default method of code reuse (even when not appropriate).

If that is the case, I would recommend making it a custom tag and
sticking
it in the custom tags folder in the CF admin.That way it is avalible to
everyone with out having to deal with mappings and all that.

G!

On Tue, May 11, 2010 at 10:56 AM, Shannon Rhodes 
wrote:

>
> I'm probably overthinking this, but I have a really simple snippet of 
code
> that I want to make easily available to other developers in-house.  It

takes
> no input variables; all it does is figure out the correct link to 
reporting
> services based on the server environment (dev/QA/prod).
>
> Given the simplicity, should this just be an include?  Or at most a
UDF
> (though I fail to see the point there, since you have to include those

too,
> and I'm not taking input parameters).  Definitely a custom tag or a
cfc 
seem
> like overkill.
>
> However, my secondary concern is that we do not have a process for 
sharing
> code in-house so I could see whatever method I choose turning into a
sort 
of
> default method of code reuse (even when not appropriate).  Also, I'm
> thinking if I'm really going to approach this properly I need to
request 
a
> mapping to a folder above the web root rather than simply throwing in
a 
new
> folder and calling it "cfincludes".  Mappings always turn into a PITA 
around
> here, but I want to do this right.
>
> Advice for getting this team moving in the right direction (noting I
am 
not
> in management here)?  Thanks!
>
> 





~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333581
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-11 Thread Jason Fisher

+1 to making it a custom tag in the server's default custom tag directory.  



> Definitely a custom tag or a
cfc seem like overkill.

Custom tag is just that:  a bit of code that can be called in a single tag, 
that's all.  Nothing 'overkill' about it to implement for a simple 
computation.   seems fairly straightforward.



From: "Gerald Guido" 
Sent: Tuesday, May 11, 2010 11:18 AM
To: "cf-talk" 
Subject: Re: Which code reuse method?

>>However, my secondary concern is that we do not have a process for 
sharing
code in-house so I could see whatever method I choose turning into a sort 
of
default method of code reuse (even when not appropriate).

If that is the case, I would recommend making it a custom tag and sticking
it in the custom tags folder in the CF admin.That way it is avalible to
everyone with out having to deal with mappings and all that.

G!

On Tue, May 11, 2010 at 10:56 AM, Shannon Rhodes 
wrote:

>
> I'm probably overthinking this, but I have a really simple snippet of 
code
> that I want to make easily available to other developers in-house.  It 
takes
> no input variables; all it does is figure out the correct link to 
reporting
> services based on the server environment (dev/QA/prod).
>
> Given the simplicity, should this just be an include?  Or at most a UDF
> (though I fail to see the point there, since you have to include those 
too,
> and I'm not taking input parameters).  Definitely a custom tag or a cfc 
seem
> like overkill.
>
> However, my secondary concern is that we do not have a process for 
sharing
> code in-house so I could see whatever method I choose turning into a sort 
of
> default method of code reuse (even when not appropriate).  Also, I'm
> thinking if I'm really going to approach this properly I need to request 
a
> mapping to a folder above the web root rather than simply throwing in a 
new
> folder and calling it "cfincludes".  Mappings always turn into a PITA 
around
> here, but I want to do this right.
>
> Advice for getting this team moving in the right direction (noting I am 
not
> in management here)?  Thanks!
>
> 



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333580
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-11 Thread Cutter (ColdFusion)

We set a variable in our onApplicationStart() method that looks at the 
server and defines an Application level variable for the server 
environment (which we'll move to the Server scope once we transition to 
CF9).

Steve "Cutter" Blades
Adobe Community Professional - ColdFusion
Adobe Certified Professional
Advanced Macromedia ColdFusion MX 7 Developer

Co-Author of "Learning Ext JS"
http://www.packtpub.com/learning-ext-js/book
_
http://blog.cutterscrossing.com



Shannon Rhodes wrote:
> I'm probably overthinking this, but I have a really simple snippet of code 
> that I want to make easily available to other developers in-house.  It takes 
> no input variables; all it does is figure out the correct link to reporting 
> services based on the server environment (dev/QA/prod).
>
> Given the simplicity, should this just be an include?  Or at most a UDF 
> (though I fail to see the point there, since you have to include those too, 
> and I'm not taking input parameters).  Definitely a custom tag or a cfc seem 
> like overkill.
>
> However, my secondary concern is that we do not have a process for sharing 
> code in-house so I could see whatever method I choose turning into a sort of 
> default method of code reuse (even when not appropriate).  Also, I'm thinking 
> if I'm really going to approach this properly I need to request a mapping to 
> a folder above the web root rather than simply throwing in a new folder and 
> calling it "cfincludes".  Mappings always turn into a PITA around here, but I 
> want to do this right.
>
> Advice for getting this team moving in the right direction (noting I am not 
> in management here)?  Thanks! 
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333576
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Which code reuse method?

2010-05-11 Thread Gerald Guido

>>However, my secondary concern is that we do not have a process for sharing
code in-house so I could see whatever method I choose turning into a sort of
default method of code reuse (even when not appropriate).


If that is the case, I would recommend making it a custom tag and sticking
it in the custom tags folder in the CF admin.That way it is avalible to
everyone with out having to deal with mappings and all that.

G!


On Tue, May 11, 2010 at 10:56 AM, Shannon Rhodes wrote:

>
> I'm probably overthinking this, but I have a really simple snippet of code
> that I want to make easily available to other developers in-house.  It takes
> no input variables; all it does is figure out the correct link to reporting
> services based on the server environment (dev/QA/prod).
>
> Given the simplicity, should this just be an include?  Or at most a UDF
> (though I fail to see the point there, since you have to include those too,
> and I'm not taking input parameters).  Definitely a custom tag or a cfc seem
> like overkill.
>
> However, my secondary concern is that we do not have a process for sharing
> code in-house so I could see whatever method I choose turning into a sort of
> default method of code reuse (even when not appropriate).  Also, I'm
> thinking if I'm really going to approach this properly I need to request a
> mapping to a folder above the web root rather than simply throwing in a new
> folder and calling it "cfincludes".  Mappings always turn into a PITA around
> here, but I want to do this right.
>
> Advice for getting this team moving in the right direction (noting I am not
> in management here)?  Thanks!
>
> 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333575
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Which code reuse method?

2010-05-11 Thread Shannon Rhodes

I'm probably overthinking this, but I have a really simple snippet of code that 
I want to make easily available to other developers in-house.  It takes no 
input variables; all it does is figure out the correct link to reporting 
services based on the server environment (dev/QA/prod).

Given the simplicity, should this just be an include?  Or at most a UDF (though 
I fail to see the point there, since you have to include those too, and I'm not 
taking input parameters).  Definitely a custom tag or a cfc seem like overkill.

However, my secondary concern is that we do not have a process for sharing code 
in-house so I could see whatever method I choose turning into a sort of default 
method of code reuse (even when not appropriate).  Also, I'm thinking if I'm 
really going to approach this properly I need to request a mapping to a folder 
above the web root rather than simply throwing in a new folder and calling it 
"cfincludes".  Mappings always turn into a PITA around here, but I want to do 
this right.

Advice for getting this team moving in the right direction (noting I am not in 
management here)?  Thanks! 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333573
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm