Per Hal Helms himself-
Yes, Troy. I've begun work on a new book, Designing OO Applications with
ColdFusion CFCs that I hope will be helpful.
-t
On Thu, 30 Dec 2004 12:25:21 -0500, Jeff Small [EMAIL PROTECTED] wrote:
Sean,
Someone should contact Hal and see if he has plans to update the
On Wed, 29 Dec 2004 13:18:43 -0500, Jeff Small [EMAIL PROTECTED] wrote:
Good lord this is a lot of...ahem...stuff to remember...
Yeah, that's why it takes most folks years to become 'fluent' in OO
design...
Cool, something else to master...lol...
There's some OO basics in the first few
Sean,
Someone should contact Hal and see if he has plans to update the book
for Blackstone.
That book got me started on CFC's and I bet that a lot of people on
this list would purchase the sequel.
Rick Mason
On Thu, 30 Dec 2004 09:53:20 -0500, Jeff Small [EMAIL PROTECTED] wrote:
On Wed,
Sean,
Someone should contact Hal and see if he has plans to update the book
for Blackstone.
That book got me started on CFC's and I bet that a lot of people on
this list would purchase the sequel.
Rick Mason
Dude...sign me UP. I'm getting tired of scouring bookmarks...lol. Even with
On Thu, 30 Dec 2004 09:53:20 -0500, Jeff Small [EMAIL PROTECTED] wrote:
Just a quick Question, then I'm off to go program for days...do you or
anyone else know if Hal's planning on updating that book? Or if someone else
has a 6.1 MX OOP book in the works?
I have heard that someone is writing a
Personally I really hate the notion of chaining setter calls (but I can
see
way others may like it). I do find that much harder to read.
But other chaining is great.
Being able to chain the create and the init() together seems perfectly
sound to me. As does any call which returns a
-Original Message-
From: Ben Rogers [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 29, 2004 10:04 AM
To: CF-Talk
Subject: RE: My Init() in my CFC...am I on the right track?
I agree. I was only referring to setter methods (though I may not have
been
very clear about
Jim Davis wrote:
As for returning this from a setter... I never thought about it, but I
might start (mine all return void now). I may personally never use it, but
if it doesn't affect performance it leaves to possibility open for others
that might want to.
I return this from pretty much
Jim Davis wrote:
As for returning this from a setter... I never thought about it, but I
might start (mine all return void now). I may personally never use it,
but
if it doesn't affect performance it leaves to possibility open for others
that might want to.
I return this from pretty much
Don't break the chain of love.
-Original Message-
From: Jeff Small [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 29, 2004 11:40 AM
To: CF-Talk
Subject: Re: My Init() in my CFC...am I on the right track?
Jim Davis wrote:
As for returning this from a setter... I never thought
So am I to understand correctly...that you can ONLY chain methods that
return this? Or that if your init function returns an object then all
methods can be chained? I'm reading all of this conversation as the former
(the first one) meaning that if you WANT to be able to chain a method,
that
Jeff Small wrote:
So am I to understand correctly...that you can ONLY chain methods that
return this?
Yes.
I'm reading all of this conversation as the former
(the first one) meaning that if you WANT to be able to chain a method, that
method needs to return this.
Correct.
Jochem
So am I to understand correctly...that you can ONLY chain methods that
return this? Or that if your init function returns an object then all
methods can be chained? I'm reading all of this conversation as the
former (the first one) meaning that if you WANT to be able to chain a
method, that
You can only chain two methods if the first method returns an object
containing the second method. If you want to chain two methods that belong
to a single object, the first method needs to return the object containing
that method (this). If you want to chain a third method, the second
Good lord this is a lot of...ahem...stuff to remember...
Fortunately, you don't really need to memorize it all as if it were a
multiplication table. You just need to think about how objects, methods and
properties work.
For example, if you want to chain methods, you can see how things work
We already know that the CreateObject call returns an instance of foo,
which
contains a method bar so we can call that. To be able to call the baz
method
within the chain, we can see that bar needs to return the same object
instance.
I wish you could see me here at my desk with that
On Wed, 29 Dec 2004 13:18:43 -0500, Jeff Small [EMAIL PROTECTED] wrote:
Good lord this is a lot of...ahem...stuff to remember...
Yeah, that's why it takes most folks years to become 'fluent' in OO design...
Where's a good reference for ALL of this conceptual stuff? Not the syntax,
or what you
On Tue, 28 Dec 2004 11:39:22 -0500, Jeff Small [EMAIL PROTECTED] wrote:
cfset init()
Be wary of calling functions from the pseudo-constructor - if the CFC
is accessed in any way, including the doc browser, it will execute
this and call the function. In general I recommend *not* calling
init()
Well I would say you maybe working a bit too hard.
If that is all you want to do you can just do this.
cfcomponent
cfset variables.DSN = myDataSourceName
cffunction ...
This sets a variable that can be used by all functions. Now the limitation of
this is that you can not
A few comments here:
*Typically i make my init function public so I can call it directly.
This lets me do this in code:
cfset mycfc = createObject(component,mycfc).init(arg1, arg2, arg3)
You need to make your method do a cfreturn this for it to work right.
*Your init function didn't have an
-Original Message-
From: Jeff Small [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 11:39 AM
To: CF-Talk
Subject: My Init() in my CFC...am I on the right track?
cfset init()
cffunction name=init access=private output=false
returntype=string
displayname=Initializes
On Tue, 28 Dec 2004 11:39:22 -0500, Jeff Small [EMAIL PROTECTED] wrote:
cfset init()
cffunction name=init access=private output=false returntype=string
displayname=Initializes my object and creates the datasource variable
cfset variables.DSN = myDataSourceName
cfreturn variables.DSN
Be wary of calling functions from the pseudo-constructor - if the CFC
is accessed in any way, including the doc browser, it will execute
this and call the function. In general I recommend *not* calling
init() automatically in the CFC but requiring users of the CFC to call
init() at
Not quite.
1) The access type on an init() function should be public, or you'll
get an error saying the method doesn't exist when you invoke it in
your calling code..
Makes *total* sense...
2) If you really want to make the value of variables.DSN public (to
pass back to calling code),
A few comments here:
*Typically i make my init function public so I can call it directly.
This lets me do this in code:
cfset mycfc = createObject(component,mycfc).init(arg1, arg2, arg3)
You need to make your method do a cfreturn this for it to work right.
*Your init function didn't have
Be wary of calling functions from the pseudo-constructor - if the CFC
is accessed in any way, including the doc browser, it will execute
this and call the function. In general I recommend *not* calling
init() automatically in the CFC but requiring users of the CFC to call
init() at
Jeff Small wrote:
5) One practice that has become a best practice of sorts is to
return this from your init method so that you can method chain, as
shown below. Granted, not everybody follows this practice, as it's
more personal preference, but it's just what I'm used to now.
I'm
-Original Message-
From: Jeff Small [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 12:18 PM
To: CF-Talk
Subject: Re: My Init() in my CFC...am I on the right track?
I'm struggling with this. I don't understand even from Seans's post what
purpose it serves to return
From: Jochem van Dieten
Jeff Small wrote:
5) One practice that has become a best practice of sorts is to
return this from your init method so that you can method chain, as
shown below. Granted, not everybody follows this practice, as it's
more personal preference, but it's just what I'm used
cfset variables.DSN = myDataSourceName
This might be a little off the best CFC practice topic, but why not create a
second CFC to govern all contact with your database(s)? This way you don't
have to worry about each CFC that lives in your world understanding database
lingo and knowing
Jeff Small wrote:
From: Jochem van Dieten
Jeff Small wrote:
I'm struggling with this. I don't understand even from Seans's post what
purpose it serves to return this when you're using something like CFOBJECT
or CreateObject() which creates an instance of an object anyway...
Because that
On Tue, 28 Dec 2004 14:18:14 -0400, Matthew Drayer [EMAIL PROTECTED] wrote:
cfset variables.DSN = myDataSourceName
This might be a little off the best CFC practice topic, but why not create
a second CFC to govern all contact with your database(s)? This way you don't
have to worry
It should be noted that you'll get slight variations from people based
on their preferences, but the code below generally covers best
practices that I've seen. Here's the cleaned up CFC and the calling
code is below it:
cfcomponent output=false
cffunction name=init access=public
Replies inline...
On Tue, 28 Dec 2004 15:00:07 -0500, Jeff Small [EMAIL PROTECTED] wrote:
It should be noted that you'll get slight variations from people based
on their preferences, but the code below generally covers best
practices that I've seen. Here's the cleaned up CFC and the calling
Named:
cfset setDSN(dsName:myDatasourceName)
or
cfset setDSN(dsName=myDatasourceName)
Aha! This I got immediately. I understand it all now and once we were both
clear on what I was doing, it makes perfect sense both in what you were
doing, and syntactically what you were writing. I've seen
On Tue, 28 Dec 2004 12:08:54 -0500, Jeff Small [EMAIL PROTECTED] wrote:
Okay, this makes sense. I'm reading about 4 different sources for how to
build CFCs correctly
I hope that includes both of the Macromedia Web Team docs :)
http:/livedocs.macromedia.com/wtg/public/
Note that even tho' the
This allows you to chain method calls, as others have noted, and will
probably help get you more into the habit of using cfset and method
calls (rather than cfinvoke which I also advise against).
Just to be clear, are you advising people to chain method calls? Personally,
I'm not crazy about
-Original Message-
From: Ben Rogers [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 28, 2004 4:35 PM
To: CF-Talk
Subject: RE: My Init() in my CFC...am I on the right track?
This allows you to chain method calls, as others have noted, and will
probably help get you more
If parameters are not needed, I would feel the init() method
is not needed. But I'm sure that is debatable.
Hey Ian,
Not trying to debate, just giving my point of view: I'd use the
init() method regardless of the need for parameters. This way, if
parameters need to be added, the external
39 matches
Mail list logo