<br><br><div class="gmail_quote">On Mon, May 7, 2012 at 10:07 PM, Chanaka Dharmarathna <span dir="ltr"><<a href="mailto:pe.chanaka.ck@gmail.com" target="_blank">pe.chanaka.ck@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><div><br><br><div class="gmail_quote">On Mon, May 7, 2012 at 6:24 PM, Rouslan Placella <span dir="ltr"><<a href="mailto:rouslan@placella.com" target="_blank">rouslan@placella.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>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" target="_blank">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" target="_blank">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" target="_blank">pe.chanaka.ck@gmail.com</a>>  napsal(a):<br>
>>><br>
>>>> I'm identifying the refactoring points in 'display_tbl.lib.php' 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 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 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 lib<br>
>>>> file, naming convention is used generally used as 'PMA_methodName'. 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 intending<br>
>>> to<br>
>>>> divide those functions to smaller ones. (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>
>>> 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" target="_blank">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 tasks<br>
>> plus making this as a class, I can use 'PMA_Display::someFunction' 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" function<br>
> in "display_tbl.lib.php" file.<br>
> As I mentioned in my previous mail, first I'm trying to render all HTML 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 that.<br>
> Ex : "PMA_generate_slider_effect" function in common.lib.php file  ->   call<br>
> by 739 line in "display_tbl.lib.php" file.<br>
><br>
> There are several situations like that, in this function. Since they have<br>
> used in other files also (test cases also implemented for them), I do 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>
</div></div>>      *echo $tableHeadersHTML; // render HTML content before another function<br>
> call which not just return a string of HTML*<br>
<div>>      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>
</div>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>
<div><div><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" target="_blank">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></div></div>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.<div>
<div><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>
</div></div></blockquote></div><br>Hi Rouslan,<br><br>Do you have any idea of using different naming conventions for this ('PMA_generate_slider_effect') function than general. (not only this, there are several functions)<br>

Generally function names are like 'PMA_meaningfulDescription()'. This does not use underscores after 'PMA_' part and use camel caps.<br>But here it is 'PMA_generate_slider_effect()'. Its different.<br clear="all">

<br>As well, Since this function is going to return a string after modifying, 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. Ex :- 'PMA_getSliderEffectGeneratingHtml()' instead of 'PMA_generate_slider_effect' (existing one)<br>

Do you have any suggestions on 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>