<br><br><div class="gmail_quote">On Sun, May 13, 2012 at 12:42 PM, Thilina Buddika Abeyrathna <span dir="ltr"><<a href="mailto:thilinaabeyrathna@gmail.com" target="_blank">thilinaabeyrathna@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marc,<div>when I'm writing functions for columns of insertForm I need to pass all the following parameters to the functions.</div>
<div><div>$field, $backup_field, $field_name_appendix, $unnullify_trigger, $tabindex, $tabindex_for_value, $idindex, $data</div>
<div>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?</div><span><font color="#888888"><div>
<br></div></font></span></div></blockquote></div>Hi Thilina,<br><br>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.<div>
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.</div><div>If non of the above applies I agree with Marc as it would make things clearer.</div>
<div><div><br></div>-- <br>Thanks and Regards,<div><br></div><div>Madhura Jayaratne<br>
<div><br></div></div><br>
</div>