Welcome Guest, Not a member yet? Register   Sign In
Do you use camelCase?
#1

[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.
#2

[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.
#3

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

[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"
#5

[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.
#6

[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.
#7

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

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

[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
#10

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




Theme © iAndrew 2016 - Forum software by © MyBB