I have just read some code in a Hibernate book that uses a lot of
method chaining ie setFoo(1).setBar('myvar').setThis(x).setThat(y) etc

I remember some old Open University days doing Smalltalk when method
chaining was common as there was no VOID return type on methods so
setter methods tended to return THIS.I have also seen this a lot
recently doing jQuery work ie $("a").addClass("test").show().html
("foo"); The methods return the jQuery object so chaining is possible.

In CF (at least the code I've read and written) we don't tend to do
this.

Is this for readability reasons or something else I'm not aware of?

I think setter methods (and maybe other methods that return VOID)
returning THIS is a sensible idea so we can chain or not chain as we
see fit.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CFCDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cfcdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to