Industry coding standards
Half of these are from NASA's Java style guide that I use at work(http://aaa.gsfc.nasa.gov/Files/JavaFinal.doc).
1. Use whitespace liberally for readability: Wrong: PHP Code:
PHP Code:
PHP Code:
PHP Code:
3. Don't exceed 80 chars per line (for code printing and reading on low-res and effectively-low-res environments). No example because it'll break the layout here, but if a line exceeds 80 chars, break it up a bit before 80, and then continue it on the next line while indenting one tab (NASA suggests two tabs but it can make the code very messy). 4. Use a 4-space (not a tab character) indent. Wrong (right from vB2...): PHP Code:
PHP Code:
1. $HTTP_POST_VARS 2. $somearray[somenonconstant] 3. mysql_db_query() Fixed: 1. $_POST 2. $somearray['somenonconstant'] (a very common problem that you need to lose!) 3. mysql_query() There are more and I don't mean to sound pushy, but every single thing I've said in this post is considered the professional industry standard and if you program for a profession then you'd be expected to follow these. |
Thx for it Filburt, but we can't consider it as mistakes ... it's just better if you don't work alone, so it is clearer for everybody ;)
I'll take care for it in the future :) |
A very good read.
|
Quote:
|
format of your code is a biggy... and fro some langiages can be a bloody joke.. ie truebasic :mad: , tho i have to admit ive seen a fair few php scripts that over look putting braces on new lines etc.
Its amazing how annoying something like that can be sometimes |
Good tips there filburt :)
- miSt |
everyone started coding in a crappy style i think, but it's improving.
vb3 will follow these standarts above :) |
Well i found out all about indenting by accident in my text editor today. It does it all automatically so... ;)
- miSt |
All times are GMT. The time now is 06:09 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|