Ask a Question related to PHP Development, Design and Development.
-
Jay Blanchard #1
RE: [PHP] dev style guide
[snip]
They use the One True Brace Style,
which is encouraging:
function fooFunction($arg1, $arg2 = '')
{
if (condition) {
statement;
}
return $val;
}
[/snip]
At the risk of starting a flame/religious/holy war I find the One True
Brace style to have some inconsistency if it is as above. The 'function'
does not open the curly brace at the EOL, but the 'if' does. I also
mentioned me being and old-schooler earlier today but the rules that we
use in our (current) group always place the opening curly at the EOL.
Also, we do not allow ternary notation. We encourage Hungarian notation,
but do not require it if the documentation is clear.
HTH!
Jay Blanchard Guest
-
Character style has a little + after style
Sometimes when I try to change some copy to a particular character style, the font won't fully change. Instead I get a small + after the style. How... -
Need help with Style conversion from Style object to Style key/value collection.
I am writing a custom control that derives from the DataGrid control. I would like to apply SelectedItemStyles and ItemStyles for use in my derived... -
Number format German style => English style when importing CSV files into MySQL-DB
Hi there, I'm trying to import a csv file into my MySQL database. Unfortunately the number format for the price column is formatted in German... -
dev style guide
Is there a style guide for coding practices used when creating code to be shared with the community? Walter -- Ankh if you love Isis. -
perl style guide
Besides the one on perldoc.com, does anyone else have any other style guides I can take a look at to get a look at feel for which one I should use?... -
Mike Migurski #2
RE: [PHP] dev style guide
>At the risk of starting a flame/religious/holy war I find the One True
Yeah, that's pretty much the definition of the OTBS. :)>Brace style to have some inconsistency if it is as above. The 'function'
>does not open the curly brace at the EOL, but the 'if' does.
I'm not sure why I find it so natural, but basically it acknowledges that
function definitions are fundamentally different (in usage and meaning)
than other code blocks. I like this.
Personally, I use ternary notation a lot, but I try to use it thusly:>I also mentioned me being and old-schooler earlier today but the rules
>that we use in our (current) group always place the opening curly at the
>EOL. Also, we do not allow ternary notation.
(condition
? statement 1
: statement 2)
The line breaks make it easier to see what's going on.
I don't think it really matters what standard you use, as long as you
*have one* and everyone in your group agrees that it's a comfortable fit,
which paradoxically seems to converge on something like what PEAR uses
anyway.
Anecdote:
At one time, a member of our group decided (on their own) that the coding
style should automatically prefer printf() constructions to double-quoted
variable interpretation, and that it should be word-wrapped to fit within
his 80-char vim terminal. An autoconversion script was written, files were
drastically modified to conform, and then subsequently committed to CVS.
This is not a proper way to go about implementing a coding standard. :P
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca [url]http://mike.teczno.com/contact.html[/url]
Mike Migurski Guest
-
Chris W. Parker #3
RE: [PHP] dev style guide
Jay Blanchard <mailto:jay.blanchard@niicommunications.com>
on Tuesday, August 05, 2003 1:23 PM said:
Ahhh.... /Hungarian/ notation. Now that makes sense. I *thought* there> We
> encourage Hungarian notation, but do not require it if the
> documentation is clear.
was something funny about "polish notation" (which as I've found out is
a certain way of expressing mathematical equations [iirc]).
I've found a few articles on Hungarian notation but none of them have
been all that great. Real wordy and without good examples. Do you have
any examples/articles to contribute?
c.
Chris W. Parker Guest
-
Jswalter #4
RE: [PHP] dev style guide
> -----Original Message-----
> From: Chris W. Parker [mailto:cparker@swatgear.com]
> Sent: Tuesday, August 05, 2003 4:33 PM
> To: Jay Blanchard; Mike Migurski; jsWalter
> Cc: [email]php-general@lists.php.net[/email]
> Subject: RE: [PHP] dev style guideOK, OK, my math geek-ness reared its ugly head.> Ahhh.... /Hungarian/ notation. Now that makes sense. I *thought* there
> was something funny about "polish notation" (which as I've found out is
> a certain way of expressing mathematical equations [iirc]).
Hungarian notation is waht I shoulfd have said.
;)
This is what I found on the issue around the 'net...> I've found a few articles on Hungarian notation but none of them have
> been all that great. Real wordy and without good examples. Do you have
> any examples/articles to contribute?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvsgen/htm
l/hunganotat.asp
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:
80/support/kb/articles/Q173/7/38.ASP&NoWebContent=1
http://www.gregleg.com/oldHome/hungarian.html
this one is short and sweet...
http://www4.ncsu.edu:8030/~moriedl/projects/hungarian/
walter
Jswalter Guest
-
Jay Blanchard #5
RE: [PHP] dev style guide
[snip]
I've found a few articles on Hungarian notation but none of them have
been all that great. Real wordy and without good examples. Do you have
any examples/articles to contribute?
[/snip]
There is a lot to go on out there
[url]http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=Hungarian+notatio[/url]
n
We have agreed on cetain types (strings are strFoo, integers are intFoo,
doubles are dblFoo, etc.) and allow for other descriptive notation where
standard terms do not work.
HTH
Jay Blanchard Guest
-
SLanger@spirit21.de #6
RE: [PHP] dev style guide
Just a remark but isn't it pointless to use Hungariannotation in a
language that is by default typeless???
Regards
Stefan Langer
SLanger@spirit21.de Guest
-
Jay Blanchard #7
RE: [PHP] dev style guide
[snip]
Just a remark but isn't it pointless to use Hungariannotation in a
language that is by default typeless???
[/snip]
We use it becuase we have a group of programmers, so the notation makes
it easier for one in the group to understand the intention of another in
the group. The notation also helps to clear up any casting issues that
may arise. [url]http://us2.php.net/language.types.type-juggling[/url]
Jay Blanchard Guest
-
Cpt John W. Holmes #8
Re: [PHP] dev style guide
From: <SLanger@spirit21.de>
I would think that it would be the reason why you WOULD want to use> Just a remark but isn't it pointless to use Hungariannotation in a
> language that is by default typeless???
Hungarian notation (not that I do, though).
Even though you can take nVar and concatinate it into a string, should you?
Maybe you should first cast it to a string, then concatinate... right?
Using the notation would mean that'd you'd know what the varaible was
intended to hold when it was created, even though it can be juggled into
another type by PHP rather easily.
---John Holmes...
Cpt John W. Holmes Guest
-
Miles Thompson #9
RE: [PHP] dev style guide
At 11:27 AM 8/6/2003 -0500, Jay Blanchard wrote:
And it helps when you get back up to speed when you revisit a project after>[snip]
>Just a remark but isn't it pointless to use Hungariannotation in a
>language that is by default typeless???
>[/snip]
>
>We use it becuase we have a group of programmers, so the notation makes
>it easier for one in the group to understand the intention of another in
>the group. The notation also helps to clear up any casting issues that
>may arise. [url]http://us2.php.net/language.types.type-juggling[/url]
a few months.
Use of Hungarian notation has been a bit of a religious issue; use what
works and use it consistently.
Of course, if you come from the Flash world, it's likely a postfix (ugly
word!) rather than prefix.
Cheers - Miles
Miles Thompson Guest
-
Phillip Blancher #10
Re: [PHP] dev style guide
Actually the word is Suffix not postfix... Prefix and Suffix.
--
Best Regards, Phil
Phillip Blancher
Web Developer & Lead Graphic Designer
< [url]http://www.ontarioweb.ca[/url] > 1-866-209-0349
< [email]phil@ontarioweb.ca[/email] >
----- Original Message -----
From: "Miles Thompson" <milesthompson@ns.sympatico.ca>
To: <php-general@lists.php.net>
Sent: Wednesday, August 06, 2003 2:37 PM
Subject: RE: [PHP] dev style guide
after> At 11:27 AM 8/6/2003 -0500, Jay Blanchard wrote:> And it helps when you get back up to speed when you revisit a project> >[snip]
> >Just a remark but isn't it pointless to use Hungariannotation in a
> >language that is by default typeless???
> >[/snip]
> >
> >We use it becuase we have a group of programmers, so the notation makes
> >it easier for one in the group to understand the intention of another in
> >the group. The notation also helps to clear up any casting issues that
> >may arise. http://us2.php.net/language.types.type-juggling> a few months.
> Use of Hungarian notation has been a bit of a religious issue; use what
> works and use it consistently.
>
> Of course, if you come from the Flash world, it's likely a postfix (ugly
> word!) rather than prefix.
>
> Cheers - Miles
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> This message has been scanned for viruses and
> dangerous content by Ontario Webs MailScanner, and is
> believed to be clean.
>
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
Phillip Blancher Guest



Reply With Quote

