Thanks Zac. That's one reason I hadn't thought of.



________________________________
From: Zac Spitzer <[email protected]>
To: [email protected]
Sent: Sunday, January 4, 2009 10:12:35 AM
Subject: [CFCDEV] Re: Method chaining


i have seen sometimes with CF is that exceptions with this style ( or
nesting ) throw
somewhat confusing error messages, i found that CF is easier to debug with the
classic line at a time

z

On Sun, Jan 4, 2009 at 8:50 PM, Alan Livie <[email protected]> wrote:
>
> 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.
>
>
> >
>



-- 
Zac Spitzer -
http://zacster.blogspot.com
+61 405 847 168



      
--~--~---------~--~----~------------~-------~--~----~
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