NetdomeWakka : CodingGuides

StartSeite :: TextSearch :: PageIndex :: RecentChanges :: Login/Account :: You are 38.107.179.230
This is meant as a common base when developing applications in a distributed, cooperative manner.
As with every Wiki page, this text can be edited by (almost) everyone. Be reasonable.

Naming

Use meaningful names for functions and variables.
Use bumpyCase styled names.

Example:
$encodingClass = "none";
function increaseLength($from, $by)


Where possible, try to group names by meaning/function, like:
$classEncoder $classDecoder
fileOpen($handle)
fileClose($handle)


Formatting

Don't use tabs. Use two spaces to indent a level.

Use K&R-style formatting.

Example:
for ($count=1; $count<=10; $count) {
}


Comments

The best comment is the code itself.
But still, you would be a big selfish dumbass ending the project as soon as you leave, when you don't COMMENT nicely! Nice said, eh?

Abstraction Layers

Never ever access a DB without a consistent abstraction layer handling at least error messages / problems for you.
Use a template system for HTML output, where applicable.