On Monday 16 February 2004 18:14, Richard Davey wrote:

> Consistency. 

With what? With whose idea of style/formatting?

I doubt you will find consistency in the real between different 
programmers/organisations. If such consistency was there then PHP would've 
have only had to support a single formatting style/syntax.

> The majority of code you can download will not use this
> notation. 

As I was trying to point out in my example, that particular notation is most 
useful where you wish to output a block of raw HTML (just to be explicit, 
without the use of echo (or print)) with an if-then-else conditional or part 
of a while-loop or similar construct.

> Although PHP coding standards are subjective as best,
I think the same could be said for many other programming languages. Only 
where the language does not allow any deviations from rigid formatting rules 
would you not have arguments/opinions over style of coding.

> you still won't find any advocating this technique. Pick a style and stick
> to it. It's usually best if that style at least matches something like
> the official PHP documentation.
>
> JW> <?php if ($something) : ?>
>
> To me this is a mess and I would never advocate this style. Code on
> the same line as a php delimiter does not make for easy reading.

To me the alternative of escaping in and out of php over 3 or more lines is 
even more of a mess.

> JW> But whichever style a book chooses to use should not impact on one's
> decision JW> as to whether it is a good book or not.
>
> Of course it does, especially when combined with the other factors I
> listed.

It should be judged by its substance (ie the other factors) and not style. All 
things being equal (ie the other factors) then yes by all means judge by 
style. But then who is the arbiter of style? As you said yourself (and I 
fully agree) it is subjective.

> If the book you're learning from doesn't teach good coding
> practise - what will? It's not something you're "born" with.

Good coding techniques/practices/styles have their own books.

Plus if you already have a programming background and you're just getting into 
PHP I doubt whether the coding style used in the book will have any influence 
on your already established coding style.

Just as you can't judge a book by its cover, you should not judge a 
programming language book by its coding style.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Q: How do you fix all Windows bugs at once?
A: Type DELTREE /Y C:\WINDOWS
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to