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 !
Le 2012-05-12 00:51, Chanaka Dharmarathna a écrit :
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.
It does not return anything.
But the name tells the function displays HTML itself.
This is exactly what this function is doing.
On Sat, May 12, 2012 at 4:58 PM, Marc Delisle marc@infomarc.info wrote:
Le 2012-05-12 00:51, Chanaka Dharmarathna a écrit :
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.
It does not return anything.
But the name tells the function displays HTML itself.
This is exactly what this function is doing.
-- Marc Delisle http://infomarc.info
Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi Marc,
It was a mistake by me. Due to I have push some of modifications to my repository, I thought they were returning string. However still there are some functions need to modify. ( PMA_buttonOrImage should be PMA_displayButtonOrImage as you pointed)
But what I actually need to suggest is, instead of render them inside functions, render them in files like sql.php Above function can be PMA_getButtonOrImage and if it need to render somewhere we can just do "echo PMA_getButtonOrImage" So that function only contains some logics (manipulations, calculations etc) and it gives a separate layer for PMA.
I did some modifications in my repository [0]. I'm stuck with these things, because when I merge PMA to my repository, there were lots of conflicts in files. Please guide me to do the right thing.
[0] : https://github.com/Chanaka/phpmyadmin/commit/bf15800089d11e83dc7998e5064dafc...
Regards !
Le 2012-05-12 08:28, Chanaka Dharmarathna a écrit :
On Sat, May 12, 2012 at 4:58 PM, Marc Delisle marc@infomarc.info wrote:
Le 2012-05-12 00:51, Chanaka Dharmarathna a écrit :
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.
It does not return anything.
But the name tells the function displays HTML itself.
This is exactly what this function is doing.
Hi Marc,
It was a mistake by me. Due to I have push some of modifications to my repository, I thought they were returning string. However still there are some functions need to modify. ( PMA_buttonOrImage should be PMA_displayButtonOrImage as you pointed)
But what I actually need to suggest is, instead of render them inside functions, render them in files like sql.php Above function can be PMA_getButtonOrImage and if it need to render somewhere we can just do "echo PMA_getButtonOrImage" So that function only contains some logics (manipulations, calculations etc) and it gives a separate layer for PMA.
I agree that these functions should only return a string.
I did some modifications in my repository [0]. I'm stuck with these things, because when I merge PMA to my repository, there were lots of conflicts in files. Please guide me to do the right thing.
[0] : https://github.com/Chanaka/phpmyadmin/commit/bf15800089d11e83dc7998e5064dafc...
Regards !
On Sat, May 12, 2012 at 8:04 PM, Marc Delisle marc@infomarc.info wrote:
Le 2012-05-12 08:28, Chanaka Dharmarathna a écrit :
On Sat, May 12, 2012 at 4:58 PM, Marc Delisle marc@infomarc.info
wrote:
Le 2012-05-12 00:51, Chanaka Dharmarathna a écrit :
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.
It does not return anything.
But the name tells the function displays HTML itself.
This is exactly what this function is doing.
Hi Marc,
It was a mistake by me. Due to I have push some of modifications to my repository, I thought they were returning string. However still there are some functions need to modify. (
PMA_buttonOrImage
should be PMA_displayButtonOrImage as you pointed)
But what I actually need to suggest is, instead of render them inside functions, render them in files like sql.php Above function can be PMA_getButtonOrImage and if it need to render somewhere we can just do "echo PMA_getButtonOrImage" So that function only contains some logics (manipulations, calculations etc) and it gives a separate layer for PMA.
I agree that these functions should only return a string.
I did some modifications in my repository [0]. I'm stuck with these things, because when I merge PMA to my repository, there were lots of conflicts in files. Please guide me to do the right thing.
[0] :
https://github.com/Chanaka/phpmyadmin/commit/bf15800089d11e83dc7998e5064dafc...
Regards !
-- Marc Delisle http://infomarc.info
Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Phpmyadmin-devel mailing list Phpmyadmin-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
Hi Marc,
I'll do the necessary changes.
Regards !