Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Happy Melon
On Tue, Nov 15, 2011 at 11:50 PM, John Du Hart compwhi...@gmail.com wrote: Right now our coding conventions manual never touches on method chaining, nor have I personally seen this practice in core. So I'm interested in what the rest of the community feels about adapting this practice

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Owen Davis
John Du Hart compwhizii at gmail.com writes: It's just another style I've encountered on other projects and I personally like. The syntax itself is fine, but at Wikia we have found (after a recent post mortem) that out of 23 Fatal Error code defects found in production, 7 of them were due

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Jeroen De Dauw
Hey, Introducing a pattern like this in a code base this large is therefore problematic. I'm tempted to agree with this. Doing $this-getOutput() -setPageTitle( wfMsg( 'abusefilter-examine' ) ) -addWikiMsg( 'abusefilter-examine-intro' ); is less clear then doing $out = $this-getOutput();

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Roan Kattouw
On Wed, Nov 16, 2011 at 12:36 PM, Jeroen De Dauw jeroended...@gmail.com wrote: Hey, Introducing a pattern like this in a code base this large is therefore problematic. I'm tempted to agree with this. Doing I think chaining is great for classes where 1) it makes sense and 2) the class is

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread trouble daemon
On Wed, Nov 16, 2011 at 6:49 AM, Roan Kattouw roan.katt...@gmail.com wrote: I think chaining is great for classes where 1) it makes sense and 2) the class is designed for it from the get-go. The Message class fits this, but I don't think OutputPage does. Ya, something from the ground up

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Platonides
(...) $this-getOutput() -setPageTitle( wfMsg( 'abusefilter-examine' ) ) -addWikiMsg( 'abusefilter-examine-intro' ); vs $out = $this-getOutput(); $out-setPageTitle( wfMsg( 'abusefilter-examine' ) ); $out-addWikiMsg( 'abusefilter-examine-intro' ); And if $out was indeed null, just the

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Trevor Parscal
Call chaining works really well for something like jQuery where you are constantly working with a generic type of data (a selection of dom nodes in that case) with common methods. Most of what you do in jQuery is either modifying what is selected, or calling methods on the selection. There are

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Brion Vibber
On Wed, Nov 16, 2011 at 3:15 AM, Owen Davis o...@wikia-inc.com wrote: John Du Hart compwhizii at gmail.com writes: It's just another style I've encountered on other projects and I personally like. The syntax itself is fine, but at Wikia we have found (after a recent post mortem) that out

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Russell Nelson
What problem is solved by chaining? All I see here is cost for no benefit. On Nov 16, 2011 5:02 PM, Brion Vibber br...@pobox.com wrote: On Wed, Nov 16, 2011 at 3:15 AM, Owen Davis o...@wikia-inc.com wrote: John Du Hart compwhizii at gmail.com writes: It's just another style I've

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-16 Thread Trevor Parscal
In jQuery the benefit is less code do do the same thing, which means less download time for the same functionality. This obviously doesn't apply to PHP. There may be other benefits to chaining in PHP code, but I don't really know of them. - Trevor On Wed, Nov 16, 2011 at 3:01 PM, Russell Nelson

[Wikitech-l] Coding Convention: Method chaining

2011-11-15 Thread John Du Hart
Right now our coding conventions manual never touches on method chaining, nor have I personally seen this practice in core. So I'm interested in what the rest of the community feels about adapting this practice more, and if there are trade offs I'm not aware of. Let's make an example, take this

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-15 Thread Niklas Laxström
On 16 November 2011 06:50, John Du Hart compwhi...@gmail.com wrote: Right now our coding conventions manual never touches on method chaining, nor have I personally seen this practice in core. So I'm interested in what the rest of the community feels about adapting this practice more, and if

Re: [Wikitech-l] Coding Convention: Method chaining

2011-11-15 Thread trouble daemon
Actually, I love the idea. Turbo Pascal's Turbo Vision framework was heavy into this. Although it did tend to get a little crazy trying to match up parens when you started to define something like a really long menu, for example. Actually, isn't there an XML class doing this in a few places?