Hi,
Thanks as well Jared,

it is easier readable, but most of the reduction in lines of code come from
taking out {} where possible, which I don't really like.

Thanks in any case, it is more readable with the function and probably an
ORM wrapper class would make it easier to understand.

On Fri, Feb 20, 2009 at 10:07 AM, anru <[email protected]> wrote:

>
> it really depend on what sort of framework you use.
> and how long time you wish to spend on re-factor you code.
>
> after re-factor, you new code may not short than old one, but the new
> code will more easy to understand.
>
> from my point of view:
>
> performance should be considered at last,  (most of time i do not care
> of performance).
>
>
> for example:
>
>     if ($entry['product_sku'] && !in_array($entry['product_sku'],
> $imp)){
> >                       $imp[] = $entry['product_sku']
>
> > }
>
> above code is hard to understand.
>
> why you want to  test ($entry['product_sku']), ?





>
> why $entry['product_sku'] will contains empty value?


Because it can be empty and therefore is not a valid attribute for the
product


>
>
> also about those flag variables:
> $last_pid = 0;
> $first = 1;
>
> unless you are the programer who wrote the code, for other, at first,
> it very hard to see
> why need this kind of flag variables here.
>

yep, you're right, I like Jared's approach with the null.




>
> //I know this can be done with less lines of code by using @,
> condensing if statements and accepting that it throws E_NOTICE some
> times.
>
> mate, do not do it, that make you code more harder to understand.
> whenever you add a @, condensing If statements,  you probably will
> need to add other 2 lines of comments to explains why you do it.
>

I totally agree, thats why I didn't want to consider it.

Kind Regards,

Jochen

--~--~---------~--~----~------------~-------~--~----~
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to