Steven Brownlee wrote:
I use this format for get/set property methods.  Every time I do ColdFusion development, I try to think of ways to code like I would (conceptually) in C#, my other main language.  That way I don't need to modify my brain patterns too much when switching back and forth.  Plus it cuts your development time in half when creating property methods.


<cffunction name="setServer" access="private" returntype="string">
      <cfargument name="newValue" required="false" type="string"> 
     
    <cfset var returnValue = "" />
     <cfif StructKeyExists(ARGUMENTS,newValue)> 
         <cfset variables.instance.server=arguments.newValue>
   <cfelse>
        <cfset returnValue = variables.instance.server> 
   </cfif>
    
    <cfreturn returnValue />
 </cffunction>
...Or you could cut your development of beans/getters/setters into basically nil! ;-)  [Shameless plug]  You could use an "semi-automated" bean creator like my Mach-II Bean Creator (thanks to Jon Block for the initial beaner as I expanded it).  It's a html/_javascript_ (ironically, no CFM needed to run it) based page that allows you to input your parameters into text boxes and it pops out a complete CFC bean for you to copy'n'paste.  Although, it's not completely foolproof or complete - it usually leaves me to set some defaults for numeric types usually - instead of typing out the whole bean.  Also, it includes an example bean button in the lower left that we create a sample bean to show you the easy to use syntax.

For more info, just see my blog entry.  There is a zip available for download in my downloads pod on the right as well  It's free...free I tell you...
http://blog.maestropublishing.com/index.cfm?mode=entry&entry=A5EC4D60-B152-F6D1-4F1E634CBA2D5048
(watch the wrap)

You can allows check out a live version at:
http://blog.maestropublishing.com/mach-ii_beaner.htm

Please be aware, I can't guarantee this link to be here forever - because I might clean it out someday without knowing it.  If you like it and want to use it, please just download it to use locally.  It's easy to modify the _javascript_ to change the syntax of the cfm code it generates to your in-house or personal specs (sorry for having to break up all of cfml tags in the _javascript_ - it wouldn't validate at the w3c unless I did).  Secondly, you don't have to use it to create full beans - I also use it if I just need a couple of getters and setters - just copy the section of the generated code you need.  It almost always open in a tab in my browser.  Beans are such low level coding - tedium to the max and they follow a simple format that doesn't ever change.

.Peter
-- 
Peter J. Farrell :: Maestro Publishing

blog	:: http://blog.maestropublishing.com
email	:: [EMAIL PROTECTED]
phone	:: 651-204-0513

 Shields up, Mr. Sulu. Arm phasers. Ready photon torpedoes.

--





----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]

Reply via email to