[Phpmyadmin-devel] Naming convention standard for methods

Chanaka Dharmarathna pe.chanaka.ck at gmail.com
Sat May 12 06:51:23 CEST 2012


Hi All,

While I'm refactoring some files relating to display query results
(currently display_tbl.lib.php, common.lib.php), I can method names are
used regardless of the inside functionality.

Ex :- "PMA_displayHtmlRadio" in common.lib.php method return a string of
HTML content.
But the name tells the function displays HTML itself.
As I feel these things should be modified.

As library files, they never should render HTML inside the functions
themselves.
Better thing is to return a string of PHP having the HTML content.

So my suggestion is to use the phrase "get" for the every method which
return any data type.
So that developer can understand it returns something just looking at the
name.
Following are some suggested names. (Some of them are already discussed in
this mailing list)

Ex:
PMA_displayHtmlRadio -> PMA_getRadioFields
PMA_generateSliderEffect -> PMA_getDivForSliderEffect
PMA_generateHtmlDropdown -> PMA_getDropdown
PMA_displayTableNavigationButton -> getTableNavigationButton
(All above functions return strings)

Hope to join a discussion on this.

Regards !
-- 
____________________________________

Chanaka Indrajith
Bsc.Computer Engineering Undergraduate
Faculty of Engineering
University of Peradeniya
Sri Lanka
____________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20120512/a63b8cd6/attachment.html>


More information about the Developers mailing list