CodeIgniter Forums

Full Version: Do you use camelCase?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]Lone[/eluser]
Yes I know, I know it has been discussed before (in a more broader context though) but I was reading through the EllisLab development guide and couldn't help but notice a strong tendancy against using camel case naming (eg. getThisData) for function and variable names. What is everyone else's preference on the use of this style? (Be good to here from DerekĀ² as well on this)

Personally I like the use of them as I think they have a neater look compared to underscore. We have got into the habit of using '_' for functions though and then camelCase for variable names.

El Forum

[eluser]Craig A Rodway[/eluser]
I agree, I find it easier to read and shorter to type than underscores.

I don't think it matters if our own coding styles differ from EllisLab's and I don't think we should change to use theirs either in our own applications just because they use a certain method.

El Forum

[eluser]dawnerd[/eluser]
Not only is camel case easier to read, but it's sure a hell of a lot faster to type.

El Forum

[eluser]ejangi[/eluser]
I use camelCase in JavaScript, but (generally) not PHP. The rule for me (usually) is to follow the Framework, but my favourite rule(s) of thumb for coding I got from Rails are:

- classes: ucfirst, camelcase; "MyGreatClass"
- methods: strtolower, underscores; "my_great_method()"
- properties: strtolower, underscores: "$my_object_property"

El Forum

[eluser]awpti[/eluser]
I do not use camecase.

I've always followed the generally idea of;

Classes: My_class
Methods (functions): my_method()
Properties: $my_prop

Same as ucant, for the most part.

El Forum

[eluser]Nick Husher[/eluser]
I don't use camelcase in PHP because there are some situations where it's case-sensitive and others where it is not, IIRC. I'd rather not ever have to think about that.

I use camelcase in Javascript, Java, and C.

El Forum

[eluser]Derek Allard[/eluser]
I like the last option. Voted.

El Forum

[eluser]Derek Jones[/eluser]
We have voted.

El Forum

[eluser]Craig A Rodway[/eluser]
FIX!! :p If you're going to rig a vote, atleast make sure it's less than or equal to the total number of site members Wink

El Forum

[eluser]Derek Allard[/eluser]
What the!?! Rig a vote? How dare you accuse us of such things... ;-P
Pages: 1 2