[Phpmyadmin-devel] Refactoring insert-edit
madhura.cj at gmail.com
Sun May 13 14:07:31 CEST 2012
On Sun, May 13, 2012 at 12:42 PM, Thilina Buddika Abeyrathna <
thilinaabeyrathna at gmail.com> wrote:
> Hi Marc,
> when I'm writing functions for columns of insertForm I need to pass all
> the following parameters to the functions.
> $field, $backup_field, $field_name_appendix,
> $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data
> So function signature is very long which is somewhat ugly, Is it ok to
> have a global parameter array for insert_edit.lib.php file. Does this break
> the refactoring?
> Hi Thilina,
Whenever you encounter a long list of parameters, I think it is a good idea
to evaluate whether your method is doing too much inside it, whether it is
possible to logically break your function into few smaller ones, each
requiring only few parameters.
Secondly if the parameters logically fit together you can introduce
parameter objects that would encapsulate the parameters as Poitr pointed
out in some other thread.
If non of the above applies I agree with Marc as it would make things
Thanks and Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Developers