You are here: Re: split large xml files « PHP Programming Language « IT news, forums, messages
Re: split large xml files

Posted by Pavel Lepin on 08/15/07 06:34

Michael Fesser <netizen@gmx.de> wrote in
<bag3c3dh4kbps3vhpiglk1hhu85mptd9kv@4ax.com>:
> .oO(Pavel Lepin)
>
>>The code I posted follows the PHP coding style guidelines
>>(the variant for short code snippets in our dev dept's
>>CMS) of the organisation I'm working for.
>
> I've seen many coding guidelines (for PHP, C/C++, Java,
> Pascal etc.), but it's the first time I came across
> something like you posted. Just two examples:
>
> foreach
> (
> ...
> )
>
> vs.
>
> for (...)
>
> Where's the logic in that?

I don't think it would be wise of me to answer this. It
would quickly get religious.

> Sometimes a line break in a control structure, sometimes
> not? Same here:
>
> $curDoc->appendChild
> (
> $curDoc->importNode ($doc->documentElement , TRUE)
> ) ;
>
> vs.
>
> $curDoc->documentElement->appendChild
> ($curDoc->importNode ($info , TRUE)) ;
>
> Illogical (IMHO).

The coding standard I'm referring to sets the maximum line
length to 78 chars; for posting to usenet I use 60 chars,
but the guideline remains the same--the second option is
used when the argument list or conditional fits one line.
Otherwise, the first option is used. Again, I'll leave the
reasoning out of this to avoid inciting YAHW.

>>other people might actually find the code easier to read
>>in the style I used
>
> I really doubt that, but YMMV. For example it's quite
> common to _not_ put a blank between a function name and
> its arguments, simply because it can be confused with a
> control structure or a property in OOP. If you like that -
> OK. But you should also think about other coders that
> might read your code. Especially about inexperienced
> coders who are asking for help in a newsgroup.

I think it's actually beneficial to neophytes to learn that
there are many coding style guidelines in the world, all of
them in conflict with each other; and that they might have
to adapt quickly, especially if they ever have to work on
several unrelated projects in consulting capacity. YMMV,
indeed.

>>It's a matter of perception, and if you believe
>>there's any sort of consensus on preferable coding style
>>even in PHP community alone, you're sadly mistaken.
>
> Of course there's not the one and only coding style (and
> never will), but there some very basic rules, which are a
> part of most if not all guidelines.

Yes, there are some, but any two people are never going to
agree *which ones* are.

> Call it common sense.

Oh, please. Don't 'should be obvious' me on something which
is too much a matter taste and habit.

--
"Patience is a minor form of despair, disguised as
virtue." -- Ambrose Bierce

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация