<br><br><div class="gmail_quote">On Tue, May 8, 2012 at 3:06 PM, Marc Delisle <span dir="ltr"><<a href="mailto:marc@infomarc.info" target="_blank">marc@infomarc.info</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Le 2012-05-08 04:57, Chanaka Dharmarathna a écrit :<br>
<div><div class="h5">> On Mon, May 7, 2012 at 10:07 PM, Chanaka Dharmarathna <<br>
> <a href="mailto:pe.chanaka.ck@gmail.com">pe.chanaka.ck@gmail.com</a>> wrote:<br>
><br>
>><br>
>><br>
>> On Mon, May 7, 2012 at 6:24 PM, Rouslan Placella <<a href="mailto:rouslan@placella.com">rouslan@placella.com</a>>wrote:<br>
>><br>
>>> On 07/05/12 09:27, Chanaka Dharmarathna wrote:<br>
>>>> On Sat, May 5, 2012 at 1:16 AM, Chanaka Dharmarathna<<br>
>>>> <a href="mailto:pe.chanaka.ck@gmail.com">pe.chanaka.ck@gmail.com</a>> wrote:<br>
>>>><br>
>>>>><br>
>>>>><br>
>>>>> On Thu, May 3, 2012 at 4:38 PM, Michal Èihaø<<a href="mailto:michal@cihar.com">michal@cihar.com</a>> wrote:<br>
>>>>><br>
>>>>>> Hi<br>
>>>>>><br>
>>>>>> Dne Tue, 1 May 2012 02:02:38 +0530<br>
>>>>>> Chanaka Dharmarathna<<a href="mailto:pe.chanaka.ck@gmail.com">pe.chanaka.ck@gmail.com</a>> napsal(a):<br>
>>>>>><br>
>>>>>>> I'm identifying the refactoring points in 'display_tbl.lib.php'<br>
>>> file. I<br>
>>>>>> am<br>
>>>>>>> trying to break the tasks on following areas.<br>
>>>>>>><br>
>>>>>>> * As a library file this should not render the HTML codes in<br>
>>> functions<br>
>>>>>> it<br>
>>>>>>> selves. First, all the HTML content in functions stored in string and<br>
>>>>>>> render at the bottom of the function.<br>
>>>>>>> Next, return the string having the HTML content, instead of<br>
>>> rendering it<br>
>>>>>>> inside the function itself and, from the calling end render that<br>
>>>>>> content.<br>
>>>>>>> Probably method names will be modified with adding 'get' phrase.<br>
>>>>>>><br>
>>>>>>> * Some naming conventions are used incorrectly. For method name in<br>
>>> lib<br>
>>>>>>> file, naming convention is used generally used as 'PMA_methodName'.<br>
>>> But<br>
>>>>>>> some are not following this.<br>
>>>>>>> While correcting them, suggested conventions in my proposal [0] is<br>
>>>>>> going to<br>
>>>>>>> applied.<br>
>>>>>>><br>
>>>>>>> * There are several functions having more than 200 lines. I'm<br>
>>> intending<br>
>>>>>> to<br>
>>>>>>> divide those functions to smaller ones.<br>
>>> (PMA_displayTableNavigation(),<br>
>>>>>>> PMA_displayTableHeaders(), PMA_displayTableBody(),<br>
>>>>>>> PMA_displayVerticalTable(), PMA_displayTable())<br>
>>>>>><br>
>>>>>> I think all this should be rather wrapped in object, so it would be<br>
>>>>>> PMA_Display::someFunction.<br>
>>>>>><br>
>>>>>> --<br>
>>>>>> Michal Èihaø | <a href="http://cihar.com" target="_blank">http://cihar.com</a> | <a href="http://blog.cihar.com" target="_blank">http://blog.cihar.com</a><br>
>>>>>><br>
>>>>>><br>
>>>>>><br>
>>> ------------------------------------------------------------------------------<br>
>>>>>> Live Security Virtual Conference<br>
>>>>>> Exclusive live event will cover all the ways today's security and<br>
>>>>>> threat landscape has changed and how IT managers can respond.<br>
>>> Discussions<br>
>>>>>> will include endpoint security, mobile security and the latest in<br>
>>> malware<br>
>>>>>> threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
>>>>>> _______________________________________________<br>
>>>>>> Phpmyadmin-devel mailing list<br>
>>>>>> <a href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a><br>
>>>>>> <a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
>>>>>><br>
>>>>>><br>
>>>>> Hi Michal,<br>
>>>>><br>
>>>>> Thanks for your reply. I got the point Michal. After the mentioned<br>
>>> tasks<br>
>>>>> plus making this as a class, I can use 'PMA_Display::someFunction'<br>
>>> where<br>
>>>>> needed.<br>
>>>>><br>
>>>>><br>
>>>>> Regards !<br>
>>>>> --<br>
>>>>> ____________________________________<br>
>>>>><br>
>>>>> Chanaka Indrajith<br>
>>>>> Bsc.Computer Engineering Undergraduate<br>
>>>>> Faculty of Engineering<br>
>>>>> University of Peradeniya<br>
>>>>> Sri Lanka<br>
>>>>> ____________________________________<br>
>>>>><br>
>>>>><br>
>>>> Hi Michal,<br>
>>>><br>
>>>> I am involving with some refactoring in "PMA_displayTableHeaders"<br>
>>> function<br>
>>>> in "display_tbl.lib.php" file.<br>
>>>> As I mentioned in my previous mail, first I'm trying to render all HTML<br>
>>> at<br>
>>>> the bottom of the function itself.<br>
>>>> But I'm facing some problems.<br>
>>>><br>
>>>> While current code rendering HTML codes using "echo", there are some<br>
>>>> function calls which does not return anything but render HTML inside<br>
>>> that.<br>
>>>> Ex : "PMA_generate_slider_effect" function in common.lib.php file -><br>
>>> call<br>
>>>> by 739 line in "display_tbl.lib.php" file.<br>
>>>><br>
>>>> There are several situations like that, in this function. Since they<br>
>>> have<br>
>>>> used in other files also (test cases also implemented for them), I do<br>
>>> not<br>
>>>> think to change those functions.<br>
>>>><br>
>>>> What I'm going to do is, remove HTML renderings everywhere inside the<br>
>>>> function, as well as possible by assigning those HTML to a variable, and<br>
>>>> render existing content in the variable before calling that kind of<br>
>>>> function (as above mentioned).<br>
>>>><br>
>>>> Ex :<br>
>>>> func {<br>
>>>> $tableHeadersHTML .= '';<br>
>>>> ----<br>
>>>> ----<br>
>>>> $tableHeadersHTML .= '<div>'<br>
>>>> . 'some html content';<br>
>>>> ----<br>
>>>> *echo $tableHeadersHTML; // render HTML content before another<br>
>>> function<br>
>>>> call which not just return a string of HTML*<br>
>>>> PMA_generate_slider_effect(params);<br>
>>>> ----<br>
>>>> // repeat the procedure<br>
>>>> }<br>
>>>><br>
>>>> Before doing this, I would like to hear your suggestions on this.<br>
>>>><br>
>>>> Regards !<br>
>>>><br>
>>><br>
>>> I think that you should rewrite the PMA_generate_slider_effect function<br>
>>> to output a string, like it should. I'd say don't worry about breaking<br>
>>> test cases for functions that do things the wrong way around, besides<br>
>>> those should simple enough to fix. As far as spotting other occurrences<br>
>>> of the function in the code base, there are only 4 of them in total (and<br>
>>> that includes the function declaration), so there is no excuse not to<br>
>>> fix all of them. To find every occurrence, run:<br>
>>><br>
>>> git grep PMA_generate_slider_effect<br>
>>><br>
>>> Bye,<br>
>>> Rouslan<br>
>>><br>
>>><br>
>>> ------------------------------------------------------------------------------<br>
>>> Live Security Virtual Conference<br>
>>> Exclusive live event will cover all the ways today's security and<br>
>>> threat landscape has changed and how IT managers can respond. Discussions<br>
>>> will include endpoint security, mobile security and the latest in malware<br>
>>> threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
>>> _______________________________________________<br>
>>> Phpmyadmin-devel mailing list<br>
>>> <a href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a><br>
>>> <a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
>>><br>
>><br>
>> Hi Rouslan,<br>
>><br>
>> That's good idea. Its better to correct those things in good manner.<br>
>> I'll try to rewrite that kind of functions. As well the tests.<br>
>><br>
>><br>
>> Regards !<br>
>> --<br>
>> ____________________________________<br>
>><br>
>> Chanaka Indrajith<br>
>> Bsc.Computer Engineering Undergraduate<br>
>> Faculty of Engineering<br>
>> University of Peradeniya<br>
>> Sri Lanka<br>
>> ____________________________________<br>
>><br>
>><br>
> Hi Rouslan,<br>
><br>
> Do you have any idea of using different naming conventions for this<br>
> ('PMA_generate_slider_effect') function than general. (not only this, there<br>
> are several functions)<br>
> Generally function names are like 'PMA_meaningfulDescription()'. This does<br>
> not use underscores after 'PMA_' part and use camel caps.<br>
> But here it is 'PMA_generate_slider_effect()'. Its different.<br>
><br>
> As well, Since this function is going to return a string after modifying,<br>
> the name should be change to give a meaning to the user (developer).<br>
> I'm thinking modify the name with 'get' phrase for that kind of functions.<br>
> Ex :- 'PMA_getSliderEffectGeneratingHtml()' instead of<br>
> 'PMA_generate_slider_effect' (existing one)<br>
> Do you have any suggestions on that ?<br>
><br>
> Regards !<br>
<br>
</div></div>PMA_getDivForSliderEffect()<br>
<br>
By the way, this is the naming convention for a global function (outside<br>
a class). Will this be inside a class?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Marc Delisle<br>
<a href="http://infomarc.info" target="_blank">http://infomarc.info</a><br>
</font></span><div class="HOEnZb"><div class="h5"><br>
------------------------------------------------------------------------------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today's security and<br>
threat landscape has changed and how IT managers can respond. Discussions<br>
will include endpoint security, mobile security and the latest in malware<br>
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br>
_______________________________________________<br>
Phpmyadmin-devel mailing list<br>
<a href="mailto:Phpmyadmin-devel@lists.sourceforge.net">Phpmyadmin-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel</a><br>
</div></div></blockquote></div><br>Hi Marc,<br><br>That name is seems pretty good. Thanks for suggesting.<br>And Marc, what about the naming convention of local (for a class) methods.<br clear="all"><br>As I feel common.lib.php file should contain a class and this function will be inside that.<br>
<br>Regards !<br>-- <br>____________________________________<br><br>Chanaka Indrajith<br>Bsc.Computer Engineering Undergraduate<br>Faculty of Engineering<br>University of Peradeniya<br>Sri Lanka<br>____________________________________<br>
<br>