[nycphp-talk] Naming conventions?
inforequest
1j0lkq002 at sneakemail.com
Thu May 5 19:42:32 EDT 2005
Daniel Krook krook-at-us.ibm.com |nyphp dev/internal group use| wrote:
>>Okay, newbie time again. When I first started with PHP and MySQL I wrote
>>some scripts to do forms and some that would be called to process the
>>forms. I'm now going back and sorting through the mess and trying to
>>come up with a standard naming scheme so I can get a better idea of
>>which script does what.
>>
>>While I'm here I wanted to ask you wiser folks what other naming
>>conventions you might suggest I start using now so I can avoid the pain
>>later...
>>
>>
>
>There are no hard and fast rules that I use, with the exception that
>underscores are a no-no. I can't stand them in filenames. Hyphens are
>the one true way to separate words in URLs. :)
>
>As for a directory structure which may be related to your question, I use
>the following structure (sans the application specific directories),
>though NYPHP Phundamentals has a whole include location how to.
>
>http://krook.org/etc/directory-structure.gif
>http://education.nyphp.org/phundamentals/PH_sitestructure.php?expiredate=11/5/2003
>
>
>
>
>
>Daniel Krook, Advisory IT Specialist
>Application Development, Production Services - Tools, ibm.com
>
>
George suggests (Adv PHP Prog):
- underscores in function names, and suggests always using meaningful
names for clarity e.g. print_hello{}
- follow Sun JAVA conventions for classes and methods
- always match var names to database fields when they correspond e.g.
SELECT firstname --> $firstname
- be cosistent as possible (whatever you call index vars, always call
them that; whateveryou call max/min/whatever stick with it)
Other than that he just suggests consistent, readable code.
More information about the talk
mailing list