NYCPHP Meetup

NYPHP.org

[nycphp-talk] naming identifiers

David Krings ramons at gmx.net
Sun Aug 30 09:39:53 EDT 2009


Kristina D. H. Anderson wrote:
> Also you can try to avoid your own confusion by giving longer, more 
> detailed names to fields.  Some people hate this idea but to me a 
> little extra typing is worth the clarity.

Not only for yourself, but everyone else dealing with your database and code. 
Also, I recommend naming fields with the same content by the same name across 
the database. So rather than calling a field "RecordID" call it "FooRecordID" 
even when that is obvious when that field is in table Foo. It doesn't get that 
obvious anymore when you use that record ID in the table Bar. Calling it just 
there "FooRecordID" may be OK, but I come across way too many tables where 
such a field is called "GizmoID" because table Foo stores the records for 
gizmos, but it isn't called "Gizmo". That really rapidly inhales. And in any 
case create and maintain a data dictionary so that one doesn't have to sift 
through all the field descriptions in the table views.

David



More information about the talk mailing list