Tuesday, June 12, 2012

GSoC 2012 - 3rd Week Progress

In my 2nd week, I did some improvements relating to readability and usability of the code including breaking large functions into sub functions. After that step, display_tbl.lib.php file contained many sub functions.

In this week, I mainly focused on applying class behavior to the display_tbl.lib.php file. After getting the confirmation from Michal Čihař for the rough design of that PMA_DisplayResults class, I started my work.

First I search for the functions which are used by the outsiders. There were only two functions (PMA_getTable(), PMA_setConfigParamsForDisplayTable()) were used by sql.php file. Excepting those two functions, private key word was used as access modifier for all other existed functions. For constructor and the above two functions were appeared as public so that any outsider can access those. All existed function names were modified by removing 'PMA_' since they becomes to local functions. The file display_tbl.lib.php was renamed as DisplayResults.class.php .

Then I looked into, remove strings used for conditions in comparisons and introduce constants instead of that. There were many constants after doing this step. If there is any need for change the value of those strings, we can do it by just changing in one place. That is an advantage of using constant.

With these processes there were lots of code violations had been occurred. Most of them were fixed excluding some warnings which were due to very long comparisons inside if conditions.

Introducing global variables for the PMA_DisplayResults class is not finished yet. It will be done in next week. Unexpectedly there was a bug due to one of my previous commits which was pointed by Marc Densile. I am going to fix it in the next week. As well, I'll start to look into refactoring other files related to display query results. Mainly I'll focus on common.lib.php file.

No comments:

Post a Comment