4 ms·
First, use whatever popular formatting is used in whatever language you are in (i.e. in PHP - UPPERCASE for constants, camelCase for functions, etc.) Benefit i
by LarryMade2 13y ago
First, use whatever popular formatting is used in whatever language you are in (i.e. in PHP - UPPERCASE for constants, camelCase for functions, etc.) Benefit is your code is just compatible with most of the other code out there.
then for me - be as descriptive and terse as possible in naming:
function validateScheduleArray($schedulearray) {...
For database fields I include the referencing table in the fieldname, (foreign keys may have the other table's name):
i.e. contact table:
contact_id
customer_id
contact_type
contact_description
contact_info
or for more specific if you have similar tables in a large database:
videocontact_id
videocustomer_id
videocontact_type
videocontact_description
videocontact_info
with that you always have an idea where something originated from.
Also I tend to go with singular terms for names in tables and fields. (contact instead of contacts) for fields with multiple values I use something like: contact_statlist
The more your source reads like psuedocode the easier it is to understand and maintain.