addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [mysql-144] Tripug: PHP Best Practices

From: Allen F.
Sent on: Monday, August 16, 2010 12:22 PM
Agreed on all points.

--- On Mon, 8/16/10, Michael Kimsal <[address removed]> wrote:

From: Michael Kimsal <[address removed]>
Subject: Re: [mysql-144] Tripug: PHP Best Practices
To: [address removed]
Date: Monday, August 16, 2010, 8:44 PM

#2 wasn't *table* prefixing - it was *field* prefixing.

*table* prefixing - legitimate uses of course - for indicating the specific app's tables relative to others.  wp_users won't generally collide with 'users' tables from other apps.  

In a perfect world I'd suggest that apps still use their own databases - I don't want my 'mantis' app have any permissions at all in another app that I'm integrating with.  However, some (many?) hosting companies only allow an account one database to use, so all app tables need to go in there, regardless of how many apps that might be.

And even so, use a sane prefix.  "tbl_" does not serve any purpose.  It was suggested to be that tbl_ might be being used to differentiate 'real' tables from views.  I'd suggest people have generally fewer views, and prefixing v_ or view_ on the front of a view is saner all around than tbl_ in front of everything.




On Mon, Aug 16, 2010 at 12:09 PM, Allen Freeman <[address removed]> wrote:
Another exception to #2: table prefixing is legitimate in instances where multiple applications or multiple instances of a single application are sharing a single database.



--- On Mon, 8/16/10, Michael Kimsal <[address removed]> wrote:

From: Michael Kimsal <[address removed]>
Subject: Re: [mysql-144] Tripug: PHP Best Practices
To: [address removed]
Date: Monday, August 16, 2010, 7:35 PM


1) Class names should not be verbs ("sendMail", "manageUsers", etc).
2) Database field names should not be prefixed with "field_" or "fld_"
or, really, anything.

Exception to #2, I occasionally see a table name used as a prefix for
an id, as in
user_id for the id column in a user table.  Not my cup of tea, but
livable if that's the only prefixed field.


On Mon, Aug 16, 2010 at 10:56 AM, Bryan <[address removed]> wrote:
> Michael and I were discussing a project he recently started working
> on, where the developer made lots of "no-nos" including but not
> limited to, creating database tables prefixed with "tbl_", for example
> "tbl_users", etc.
>
> It got me thinking, what are a few best practices? If you were
> speaking to a beginning developer what are some of the things you
> would stress?
>
> Ill start off with a few suggestions:
>
> 1. Use meaning full and consistent names.
> 2. Clearly comment your code.
> 3.  Don't use short open tags ie) <? ?>
> 4. Use whitespace and indent your code to improve readability
>
> I got us started with 4 basic tips, now its your turn.
>
>
>
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> http://www.meetup.com/mysql-144/
> This message was sent by Bryan ([address removed]) from The Raleigh MySQL/PHP Meetup Group.
> To learn more about Bryan, visit his/her member profile: http://www.meetup.com/mysql-144/members/7335984/
> To unsubscribe or to update your mailing list settings, click here: http://www.meetup.com/mysql-144/settings/
> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>
>



--
Michael Kimsal
http://jsmag.com - for javascript developers
http://groovymag.com - for groovy developers
http://indieconf.com - web freelancer conference
[masked]



--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
http://www.meetup.com/mysql-144/
This message was sent by Michael Kimsal ([address removed]) from The Raleigh MySQL/PHP Meetup Group.
To learn more about Michael Kimsal, visit his/her member profile: http://www.meetup.com/mysql-144/members/2404700/
To unsubscribe or to update your mailing list settings, click here: http://www.meetup.com/mysql-144/settings/
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Allen Freeman ([address removed]) from The Raleigh MySQL/PHP Meetup Group.
To learn more about Allen Freeman, visit his/her member profile

To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]



--
Michael Kimsal
http://jsmag.com - for javascript developers
http://groovymag.com - for groovy developers
http://indieconf.com - web freelancer conference
[masked]




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Michael Kimsal ([address removed]) from The Raleigh MySQL/PHP Meetup Group.
To learn more about Michael Kimsal, visit his/her member profile
To unsubscribe or to update your mailing list settings, click here

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy