NYCPHP Meetup

NYPHP.org

[nycphp-talk] Best practices for naming conventions & coding style?

Edward Potter edwardpotter at gmail.com
Tue Apr 28 10:51:18 EDT 2009


I just kind of like:  delete from companies where id = 1;

I think this is more of a rails syntax.  just so zen simple!  but everyone
comes up with their best naming. we are all different, as long as it's
consistent.

I never use person as a field name.   Leads to confusion. I think you can be
a bit more specific then that.

I look at source code for naming conventions, how does mediawiki do it
(wikipedia)?  pear things, oracle code. CSS for major sites (NYTs), etc.
Yes, even google, but they are a bit looser in naming conventions, which may
be ok. too rigid and u can shoot yourself.

I'm really an ObjC guy (iPhone), where u really have monster long names, a
smalltalk feature grafted onto c++.

:-)



On Tue, Apr 28, 2009 at 8:54 AM, Daniel Convissor <
danielc at analysisandsolutions.com> wrote:

> On Mon, Apr 27, 2009 at 10:18:42PM -0400, Edward Potter wrote:
> >
> > employees
> > --------------
> > id
> > firstname   <= generally for my field names I'll link words with _, just
> > firstname and lastname I concatenate.
> > lastname
> > company_id
> >
> >
> > companies
> > -------------
> > id
> > company
>
> But in that scheme, in order to join tables, you have to use an ON syntax
>   JOIN companies ON (companies.id = employees.company_id)
> rather than the more elegant USING syntax
>   JOIN companies USING (company_id)
>
> Plus it causes the use of different words for table vs field names,
> making it harder to guess/remember what a given identifier's name is and
> results in hacks when implementing automated schema tools.
>
> --Dan
>
> ... snip ...
>
> --
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>            data intensive web and database programming
>                http://www.AnalysisAndSolutions.com/
>  4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409
> _______________________________________________
> New York PHP User Group Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> http://www.nyphp.org/show_participation.php
>



-- 
IM/iChat: ejpusa
Links: http://del.icio.us/ejpusa
Follow me: http://www.twitter.com/ejpusa
Karma: http://www.coderswithconscience.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20090428/7e2ce367/attachment.html>


More information about the talk mailing list