Recent Topics

1 Jul 10, 2006 15:07    

The naming standards brought up here;
http://manual.b2evolution.net/Standard_Coding_Guidelines#Variable_names.2C_Member_names.2C_Class_names

1) Should 'ID' be upercase or lowercase? In b2evolution it is always uppercase but then this goes against the standards doesn't it....

2) Should array keys/indexes be all lowercase?

3) Should database columns be all lowercase?

4) Should function names be all lowercase?

5) When should a _ be used?
a) function getOption(); or function get_Option(); or function getoption(); function get_option; ?
b) $arraySize; or $array_Size; or $arraysize; or $array_size; ?

Cheers.

I'll update the wiki appropriatly.

2 Jul 10, 2006 16:39

You code people are crazy!

I'm not a code person - I'm just a hack (who started hacking when TRS80s were the coolest thing on the market) so to me I just looked at stuff (in b2evolution) and sort of got used to "this is how they do it", and generally copy what I think I see as 'the way'. Never thought to drill down and wonder about the detailed questions you've raised. I guess to me the overall flavor is intuitive, but obviously the specifics are a bit off the map. To me ID should be capitalized no matter what a 'rule' might say because it then obviously means we're talking about an ID number of some sort.

Wanna know which part of 'the way' bugs me?

if( $whatever == $yeahsure )
{
    do something
    and another thing
    and the last thing
}


I think it looks like crap.

if( $whatever == $yeahsure ) {
    do something
    and another thing
    and the last thing
    }


To me that makes the code look so much cleaner.

Half past 7 in the morning . . . ;)

3 Jul 10, 2006 16:43

TRS80s

Damn, showing yer age there ;)

¥

4 Jul 10, 2006 16:45

HAha yeh, the brackets thing pisses me off, i'm a typical:

if ( $MyVar == $AnotherVarThatIsQuiteLong ) {
   // do code
}

But i do not always follow the bracket on it's own line rule all the time, but i've started doing it most of the time as i'm actually properly documenting my code.

As for the ID thing, then what about URL? should that be uppercase or lowercase?

Either way, i want to know what the actual standard says, because it sux sitting there thinking... 'hrmmm if i use a upercase here, will it be bad' etc.

Yeh ;)

11 at night ;) (but i'm feeling it)


Form is loading...