Re: [PEPr] Comment on Internationalization::I18N_UnicodeNormalizer
| From: | till | Date: | Sat, 16 Jun 2007 10:26:51 +0000 |
| Subject: | Re: [PEPr] Comment on Internationalization::I18N_UnicodeNormalizer | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-47053@lists.php.net to get a copy of this message | ||
Hi,
On 15 Jun 2007 17:26:29 -0000, Michel Corne <mcorne@yahoo.com> wrote:
[pear-dev] "... some of your code is hard to read (lines are pretty long)..." [MC] The lines are long because there is the code itself and a comment right after. I comment each line because it is easier for me to maintain the code when I go back to it weeks/months after. Also, we have large screens these days and editors with smart highlighting which I believe makes the whole things pretty readable. We also all have different styles to program I guess :-)I am all for big screens and IDEs with fancy code highlighting. Truth to be told, I do not always have the luxery which is why I really like certain standards. But maybe that's just me. Also, please check here: http://pear.php.net/manual/en/standards.php In terms of line length, my number one reason to keep a line on a certain length is, to be able to print code later on - which is necessary sometimes. ;-) Then as I stated above, sometimes the tools you work with are not the best. Other reasons as of why I like "it" fixed are that a long line really tends to attract more errors and makes it (even for the original author) harder to grasp what's being done there when you look at it a couple weeks from now. Also, try to keep in mind that others will look at your code or that maybe one day, you don't have time to update it and someone else would take over.
[pear-dev] "... some of the if()'s seem a bit complicated - for example, exit early, instead of long code inside the condition and exit in the else part..." [MC] Good point regarding exiting early. I used to do as you say for years. Then I changed things more recently. I may have to change that back... The normalization rules are not easy to understand nor to implement which may reflect in the code. This requires many conditions tests and recursive programing. I am open to simplifying what I wrote, please be more specific so I can take a look at it again.Well, my recommendation is not a rule and I wasn't going to suggest that you have to do it everywhere. Just do it where it's appropriate.
[pear-dev] "...I'd (personally) always use empty() to test instead of, if ($foo != '')..." [MC] Yeah, yeah... I use empty() too... depends on the day :-) Note that it is not strictly the same thing.Not sure what you are getting at, but for what I saw in your code, empty() should work. I know that 0 is also empty, false, NULL etc. as well. So anyway, use as you see it fits, it was just a though.
[pear-dev] "...you should list the multibyte extension as a dependency..." [MC] I did not know that we had to list extensions as dependencies. No problem. Where should I list that?On the proposal. ;-) Cheers, Till