From: Nathan D. <na...@ch...> - 2002-09-03 23:24:55
|
[I have also added this to the documents at SourceForge] I just checked in some cleanup of the CFFUNCTIon attributes, so everything now has: output="no" access="foo" returnType="foo" hint="foo" From this point forward all methods must have these to be considered complete. Also, I have taken to using the convention of storing all "private" data members in a struct called "instance", so at the top of every component (every base component, that is), I have: <cfparam name="instance" default="#structNew()#"> Then, all private stuff is put in instance. This allows easy stuff like: instance.foo = arguments.foo It also allows you to define a CFPROPERTY with a type="instance" and have it created as a private variable when the component is instantiated. Also, all CFC's have an init() method that returns "this" and specifies the base component as the returnType: At its simplest, they do this: <!--- the initializer ---> <cffunction name="init" access="public" returnType="org.bacfug.modus.validation.baseRule" output="no" hint="initialize this instance"> <cfreturn this> </cffunction> All instance vars typically get their default value in the init(), NOT in the constructor. This allows for much fewer headaches during the implementations of the base components. In general, method names should be fairly simple. A few popular prefixes I am using in Modus: getFoo() setFoo() makeFoo() BarToFoo() isFoo() Outside of that, it tends to be simple: save() load() validate() camelHump style is used throughout for variable and method names. All tags are lower case CFSCRIPT is used heavily, when possible. ALL local variables inside of methods are created using <CFSET var foo = "bar"> |