Php code guidelines, is it necessary for just one programmer ?
Php code guidelines, is it necessary for just one programmer ?
am 09.11.2007 00:40:02 von __
What do you think about php coding guidelines ? I know for sure that
every big php project needs one, all those programmers need common
rules to code, but do you think that is necessary for just one
programmer ?
And if the answer is yes what code guidelines do you recommend ?
I found the phpbb3 group coding guideliness http://area51.phpbb.com/docs/coding-guidelines.html
and also this http://codeassembly.com/Why-are-php-coding-guidelines-import ant/
and of course the PEAR coding guideliness
http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
I know pear is kind of standard but there are lots of thinks that I
don't like about it, like putting the bracket on the same line ...
Waiting for your opinions.
Thanks.
Re: Php code guidelines, is it necessary for just one programmer ?
am 09.11.2007 01:18:26 von Steve
"__" wrote in message
news:1194565202.597932.55410@e9g2000prf.googlegroups.com...
> What do you think about php coding guidelines ? I know for sure that
> every big php project needs one, all those programmers need common
> rules to code, but do you think that is necessary for just one
> programmer ?
> And if the answer is yes what code guidelines do you recommend ?
> I found the phpbb3 group coding guideliness
> http://area51.phpbb.com/docs/coding-guidelines.html
> and also this
> http://codeassembly.com/Why-are-php-coding-guidelines-import ant/
> and of course the PEAR coding guideliness
> http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
> I know pear is kind of standard but there are lots of thinks that I
> don't like about it, like putting the bracket on the same line ...
> Waiting for your opinions.
> Thanks.
yes, it's important. if you do start to work with others in collaboration,
you'll be happy you've already been doing what is best. further, if you go
to an employer who wants to see some of your work, they'll certainly like to
know that you are already on board in that sense.
as for which one? be familiar with them all. pick one that makes sense for
you. it's your choice for now.
Re: Php code guidelines, is it necessary for just one programmer?
am 09.11.2007 01:18:53 von Jerry Stuckle
__ wrote:
> What do you think about php coding guidelines ? I know for sure that
> every big php project needs one, all those programmers need common
> rules to code, but do you think that is necessary for just one
> programmer ?
> And if the answer is yes what code guidelines do you recommend ?
> I found the phpbb3 group coding guideliness http://area51.phpbb.com/docs/coding-guidelines.html
> and also this http://codeassembly.com/Why-are-php-coding-guidelines-import ant/
> and of course the PEAR coding guideliness
> http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
> I know pear is kind of standard but there are lots of thinks that I
> don't like about it, like putting the bracket on the same line ...
> Waiting for your opinions.
> Thanks.
>
>
Yes, standards are important for ANYONE. Even one person shops.
But it's impossible to give you any *good* guideline recommendations.
There are several around; look at them and find one which fits our
coding style.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Php code guidelines, is it necessary for just one programmer ?
am 09.11.2007 01:55:58 von Larry Anderson
As a solo coder for many years I've evolved before PHP in cleaning up
some of my coding practices (when you have 10+ years of code to
maintain you learn the hard way the importance of good coding
practices. Since starting PHP I've adopted many PHP coding guidelines
for formatting etc.
It makes life a lot easier to have well formatted code, in debugging
you will know where you are in a decision process or a loop, and a
couple years down the road the formatting variable/function naming and
comments will save you a lot of time getting back up to speed when you
revisit your old code.
I use a lot of Pear formatting guidelines for my code - I don't use
Pear but a lot of their guidelines are very common sense stuff. And
if I ever do at least I'm part way there.
have a look and see what you think:
http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
Larry
Re: Php code guidelines, is it necessary for just one programmer ?
am 09.11.2007 03:45:57 von Shelly
larry@portcommodore.com wrote:
> As a solo coder for many years I've evolved before PHP in cleaning up
> some of my coding practices (when you have 10+ years of code to
> maintain you learn the hard way the importance of good coding
> practices. Since starting PHP I've adopted many PHP coding guidelines
> for formatting etc.
>
> It makes life a lot easier to have well formatted code, in debugging
> you will know where you are in a decision process or a loop, and a
> couple years down the road the formatting variable/function naming and
> comments will save you a lot of time getting back up to speed when you
> revisit your old code.
>
> I use a lot of Pear formatting guidelines for my code - I don't use
> Pear but a lot of their guidelines are very common sense stuff. And
> if I ever do at least I'm part way there.
>
> have a look and see what you think:
> http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
>
> Larry
I like the Java naming conventions. I also like K&R block structure for
braces. I use two space tabs. I also put a space before and after an
equals sign or logical operations or concatenation operators. Names should
ALWAYS be meaningful. In multiple condition conditionals I put each
condition in its own parentheses. Also, I like to keep file short. If
there are several operations that are sizable, I will put each in a separate
file (with a good name) and use a require statement. These are a few of the
things I have adopted over the years and it has paid off as both a lone
programmer and as part of a group.
--
Shelly
Re: Php code guidelines, is it necessary for just one programmer ?
am 09.11.2007 08:22:01 von FFMG
As a C++ programmer using php I tend to follow codding standards that
fit both languages, (they are so close anyway).
I agree with what others have said, choose a standard that you like and
stick to it.
Even if you are on your own it is better to look at many projects that
all follow the same standard. And you can re-use code as well knowing
that it should fit well in your current project.
I am in the case where I have been writing a small app on my own for
the past year, now that it is picking up speed more and more coders are
helping me and it helps that I already had some form of standard to
follow.
FFMG
--
'webmaster forum' (http://www.httppoint.com) | 'Free Blogs'
(http://www.journalhome.com/) | 'webmaster Directory'
(http://www.webhostshunter.com/)
'Recreation Vehicle insurance'
(http://www.insurance-owl.com/other/car_rec.php) | 'Free URL
redirection service' (http://urlkick.com/)
------------------------------------------------------------ ------------
FFMG's Profile: http://www.httppoint.com/member.php?userid=580
View this thread: http://www.httppoint.com/showthread.php?t=22024
Message Posted via the webmaster forum http://www.httppoint.com, (Ad revenue sharing).
Re: Php code guidelines, is it necessary for just one programmer ?
am 10.11.2007 22:59:43 von 4sak3n 0ne
On Nov 8, 7:45 pm, "Shelly" wrote:
> la...@portcommodore.com wrote:
> > As a solo coder for many years I've evolved before PHP in cleaning up
> > some of my coding practices (when you have 10+ years of code to
> > maintain you learn the hard way the importance of good coding
> > practices. Since starting PHP I've adopted many PHP coding guidelines
> > for formatting etc.
>
> > It makes life a lot easier to have well formatted code, in debugging
> > you will know where you are in a decision process or a loop, and a
> > couple years down the road the formatting variable/function naming and
> > comments will save you a lot of time getting back up to speed when you
> > revisit your old code.
>
> > I use a lot of Pear formatting guidelines for my code - I don't use
> > Pear but a lot of their guidelines are very common sense stuff. And
> > if I ever do at least I'm part way there.
>
> > have a look and see what you think:
> >http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.sta ndards.html
>
> > Larry
>
> I like the Java naming conventions. I also like K&R block structure for
> braces. I use two space tabs. I also put a space before and after an
> equals sign or logical operations or concatenation operators. Names should
> ALWAYS be meaningful. In multiple condition conditionals I put each
> condition in its own parentheses. Also, I like to keep file short. If
> there are several operations that are sizable, I will put each in a separate
> file (with a good name) and use a require statement. These are a few of the
> things I have adopted over the years and it has paid off as both a lone
> programmer and as part of a group.
>
> --
> Shelly
Is there a specific reason for using spaces instead of tabs? I still
use tabs, but format them to 2 spaces.
Re: Php code guidelines, is it necessary for just one programmer ?
am 11.11.2007 00:00:48 von Bucky Kaufman
"4sak3n 0ne" <4sak3n0ne@gmail.com> wrote in message
news:1194731983.215223.86330@k35g2000prh.googlegroups.com...
> Is there a specific reason for using spaces instead of tabs? I still
> use tabs, but format them to 2 spaces.
Almost totally a matter of preference.
I sometimes work on code from a guy who indents a double-space at a time;
while I do it a tab at a time.
He pointed out that it makes his *printed* code better fit on the page - and
he's right.
I still use tabs, but I'll be integrating his idea in my releases.
For release, ya always gotta do some cleanup and, making the code print
better seems to be a good one.
Re: Php code guidelines, is it necessary for just one programmer ?
am 11.11.2007 00:44:29 von Larry Anderson
On Nov 10, 3:00 pm, "Sanders Kaufman" wrote:
> "4sak3n 0ne" <4sak3n...@gmail.com> wrote in message
>
> news:1194731983.215223.86330@k35g2000prh.googlegroups.com...
>
> > Is there a specific reason for using spaces instead of tabs? I still
> > use tabs, but format them to 2 spaces.
>
> Almost totally a matter of preference.
>
I started using tabs but read the reason people use spaces is because
tabs can be interpreted as different lengths on various editors or not
at all. A space is a space, or four in my case of code indenting.
Re: Php code guidelines, is it necessary for just one programmer?
am 11.11.2007 01:10:15 von Jerry Stuckle
4sak3n 0ne wrote:
> On Nov 8, 7:45 pm, "Shelly" wrote:
>> la...@portcommodore.com wrote:
>>> As a solo coder for many years I've evolved before PHP in cleaning up
>>> some of my coding practices (when you have 10+ years of code to
>>> maintain you learn the hard way the importance of good coding
>>> practices. Since starting PHP I've adopted many PHP coding guidelines
>>> for formatting etc.
>>> It makes life a lot easier to have well formatted code, in debugging
>>> you will know where you are in a decision process or a loop, and a
>>> couple years down the road the formatting variable/function naming and
>>> comments will save you a lot of time getting back up to speed when you
>>> revisit your old code.
>>> I use a lot of Pear formatting guidelines for my code - I don't use
>>> Pear but a lot of their guidelines are very common sense stuff. And
>>> if I ever do at least I'm part way there.
>>> have a look and see what you think:
>>> http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.stan dards.html
>>> Larry
>> I like the Java naming conventions. I also like K&R block structure for
>> braces. I use two space tabs. I also put a space before and after an
>> equals sign or logical operations or concatenation operators. Names should
>> ALWAYS be meaningful. In multiple condition conditionals I put each
>> condition in its own parentheses. Also, I like to keep file short. If
>> there are several operations that are sizable, I will put each in a separate
>> file (with a good name) and use a require statement. These are a few of the
>> things I have adopted over the years and it has paid off as both a lone
>> programmer and as part of a group.
>>
>> --
>> Shelly
>
> Is there a specific reason for using spaces instead of tabs? I still
> use tabs, but format them to 2 spaces.
>
>
Tabs save space, but are dependent on editor settings. If your tabs are
set to 2 space, no real problem. But if your editor sets tabs to 8
spaces, you'll quickly notice the difference.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Php code guidelines, is it necessary for just one programmer ?
am 13.11.2007 01:05:20 von 4sak3n 0ne
On Nov 10, 5:10 pm, Jerry Stuckle wrote:
> 4sak3n 0ne wrote:
> > On Nov 8, 7:45 pm, "Shelly" wrote:
> >> la...@portcommodore.com wrote:
> >>> As a solo coder for many years I've evolved before PHP in cleaning up
> >>> some of my coding practices (when you have 10+ years of code to
> >>> maintain you learn the hard way the importance of good coding
> >>> practices. Since starting PHP I've adopted many PHP coding guidelines
> >>> for formatting etc.
> >>> It makes life a lot easier to have well formatted code, in debugging
> >>> you will know where you are in a decision process or a loop, and a
> >>> couple years down the road the formatting variable/function naming and
> >>> comments will save you a lot of time getting back up to speed when you
> >>> revisit your old code.
> >>> I use a lot of Pear formatting guidelines for my code - I don't use
> >>> Pear but a lot of their guidelines are very common sense stuff. And
> >>> if I ever do at least I'm part way there.
> >>> have a look and see what you think:
> >>>http://www-eleves-isia.cma.fr/documentation/PhpDoc/pear.s tandards.html
> >>> Larry
> >> I like the Java naming conventions. I also like K&R block structure for
> >> braces. I use two space tabs. I also put a space before and after an
> >> equals sign or logical operations or concatenation operators. Names should
> >> ALWAYS be meaningful. In multiple condition conditionals I put each
> >> condition in its own parentheses. Also, I like to keep file short. If
> >> there are several operations that are sizable, I will put each in a separate
> >> file (with a good name) and use a require statement. These are a few of the
> >> things I have adopted over the years and it has paid off as both a lone
> >> programmer and as part of a group.
>
> >> --
> >> Shelly
>
> > Is there a specific reason for using spaces instead of tabs? I still
> > use tabs, but format them to 2 spaces.
>
> Tabs save space, but are dependent on editor settings. If your tabs are
> set to 2 space, no real problem. But if your editor sets tabs to 8
> spaces, you'll quickly notice the difference.
>
> --
> ==================
> Remove the "x" from my email address
> Jerry Stuckle
> JDS Computer Training Corp.
> jstuck...@attglobal.net
> ==================
Cool, thanks. I'll keep these thoughts in mind.
Re: Php code guidelines, is it necessary for just one programmer ?
am 13.11.2007 02:27:22 von Shelly
4sak3n 0ne wrote:
> On Nov 10, 5:10 pm, Jerry Stuckle wrote:
>> 4sak3n 0ne wrote:
>>> On Nov 8, 7:45 pm, "Shelly" wrote:
>>>> la...@portcommodore.com wrote:
>>> Is there a specific reason for using spaces instead of tabs? I
>>> still use tabs, but format them to 2 spaces.
I actually tab, but I have my tabs set to two spaces. Yes, there is a
reason FOR ME to use two spaces. One space doesn't give enough clarity for
me to readily see the blocking, and four spaces can quickly get to lines
starting on the right half of the page. So, it was between two and three
and I chose two.
--
Shelly
Re: Php code guidelines, is it necessary for just one programmer ?
am 13.11.2007 15:18:45 von Steve
"Shelly" wrote in message
news:13jhverpimalu56@corp.supernews.com...
> 4sak3n 0ne wrote:
>> On Nov 10, 5:10 pm, Jerry Stuckle wrote:
>>> 4sak3n 0ne wrote:
>>>> On Nov 8, 7:45 pm, "Shelly" wrote:
>>>>> la...@portcommodore.com wrote:
>>>> Is there a specific reason for using spaces instead of tabs? I
>>>> still use tabs, but format them to 2 spaces.
>
> I actually tab, but I have my tabs set to two spaces. Yes, there is a
> reason FOR ME to use two spaces. One space doesn't give enough clarity
> for me to readily see the blocking, and four spaces can quickly get to
> lines starting on the right half of the page. So, it was between two and
> three and I chose two.
i think that's a pretty common practice. we (our company) doesn't care if
you space or tab. however, and a big however, is that when your editor saves
your work, it must convert all tabs to two spaces and \r\n to \n. each of us
uses different editors but it's the end result they want.
a lot of that has to do with customization of the editor you are using. most
of us use some flavor of vim but among those, each makes it look and act in
a personalized way. same thing with windows editors (not that vim can't be
run in windows). so even if we were to standardize and force everyone to use
the same editor, the problem wouldn't go away.
for me, nothing beats a fixed width font (like courier new) at 8pt using 2
spaces for tabs, trailing spaces trimmed on save, and \r\n replaced with \n.
luckily, most editors are configurable to do all of that...all you need to
do is keep coding and all of that is handled.