User "Bryan" posted a comment on MediaWiki.r85922.

Full URL: 
https://secure.wikimedia.org/wikipedia/mediawiki/wiki/Special:Code/MediaWiki/85922#c15912

Comment:

Welcome to commit land!

I have some advise for you, mostly related to code style. See also 
[[Manual:Coding conventions]].

You should follow code conventions for variables. Thus $lastSection instead of 
$last_section. Your variables should be more descriptive. Use $tableDescriptor 
rather than $t.

Check your whitespace use: <tt>array_pop( $a )</tt> instead of 
<tt>array_pop($a)</tt>. You can use stylize.php to enfore this style.

Function names should really indicate what it does: a function called 
<tt>printTableHtml</tt> is expected to print/echo something to the output. It 
does not do that, it makes a string containing the table html. It should thus 
be named build/create/makeTableHtml; choose your favorite. 


Personally I don't really like mixed key arrays, where numeric keys indicate 
data elements, and string keys indicate attributes/options. I'd rather use a 
nested array solution, like <tt>array( 'attributes' => array( ... ), 'caption 
=> '...', 'data' => array( $row1, $row2, ... ) )</tt>. Then you can use foreach 
on $t['data'] which is much cleaner than <tt>for ( $i = 0; isset( $t[i] ); $i++ 
)</tt>.

_______________________________________________
MediaWiki-CodeReview mailing list
mediawiki-coderev...@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to