Quote:
Originally Posted by WhiteDragon
I don't mind if this gets unstuck, but I still believe everything I wrote in here is more or less proper.
Could you elaborate perhaps?
Regarding the class capitalizing, I would change that but I can't edit this anymore.
It isn't a standard. I'm trying to appeal to people's intuitions about rules that have a logical backing.
If there a rule that work better for you, by all means use them. I'm also open to arguing any of the suggestions I provided.
|
For the thread to be stuck pretty much says it is the "correct" way to do things. A few points:
- Variable declarations serve absolutely no purpose to the engine, and can't possibly have any other effect except slowing it down, even if ever so slightly. Saying that all variables should be declared before being initialized is incorrect and personal preference. It is probably better to just use comments for listing variables.
- The indentation of your switch statement is wacky. This is just my personal preference, but yours is being promoted as some kind of standard.
PHP Code:
switch (variable) {
case "value":
// whatever
break;
case "value2":
// whatever2
break;
}
switch statements don't really have a universal format, though.
- Falling through in switch statements isn't a problem unless you work on a server with really poor scripters.
- 'default' needs to end with a break or return as well. Keep in mind it doesn't have to be at the end of the list.
- Apparently classes can't even start with an uppercase letter, and even if they could/can, that would be different than what 99% of servers are doing now.
The thread is well-intentioned, but I don't like how it tries to set the "right" way to script based on someone's ideas. I wouldn't have a problem if the thread was reposted/edited with the controversial/incorrect stuff removed. There are also some things that need further explanation, such as the return statement. The way it's worded now it could be seen that something like:
PHP Code:
return (((a ^ 2) + (b ^ 2)) ^ .5);
is wrong, when it's clearly not.