On Thursday, Jan 30, 2003, at 12:02 US/Pacific, Dave Watts wrote:
>> me.setFirstName("Sean").setLastName("Corfield");
> I hadn't seen that syntax before with CFCs, but that's ok, since I
> don't
> care for it. I think it's sensible enough when you have actual object
> hierarchies
It's pretty common in C++ and Java to have methods return "this" so you
can do method chaining, i.e., returning the same (modified) object.
> I think it makes the code
> less readable, since "me.setFirstName("Sean")" returns the object "me".
I'm used to it so it makes sense to me - I know that "setXxx(x)" will
set the "xxx" property to "x" and then return the (modified) object.
Admittedly, I used it less in Java than I did in C++ and I don't find
myself writing quite the same style of code in CF so I use it even less
now.
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4