• entries
    383
  • comments
    1075
  • views
    352595

Silly poll

Sign in to follow this  

192 views

The current poll on the main page at the moment is:

"What naming convention (excluding notation) do you use for classes, functions, variables, etc?"

Options:
  • CamelCase
  • Under_scores
  • lowerFirst
  • none
  • Other


My query: does anyone exclusively use the same naming convention for classes, functions and variables?

Me? These days I use CamelCase for classes and lowerFirst for variables. Sometimes I fall back into my old habit of using under_scores for variables instead. These days I'm also using CamelCase for functions, but I used to use lowerCase for them (sometimes with under_scores with variables). And I often do prefixes with undercores too, such as labelling private variables as "my_variableName", mixing under_scores with lowerFirst.

I thought most people mixed it up a little, especially between variables and classes/functions.

(P.S. I'm still alive and doing stuff. I'm finishing up the last bit of business for the year, then hoping to dive into refreshing my programming skills within a week. I'll be posting more journal entries and forum questions then.)
Sign in to follow this  


6 Comments


Recommended Comments

Quote:

Me? These days I use CamelCase for classes and lowerFirst for variables.


Same. CamelCase for classes and lowerFirst for variables / functions. (I picked other for the poll).

Share this comment


Link to comment
Quote:
Original post by sprite_hound
Quote:

Me? These days I use CamelCase for classes and lowerFirst for variables.


Same. CamelCase for classes and lowerFirst for variables / functions. (I picked other for the poll).


Also same. I can almost exclusively blame Java for doing this to me. [grin]

Something I'm amused by but never had the gall to do is the usage of an underscore prefixing private class member names.

Share this comment


Link to comment
hmmm, I've always referred to what you're calling "CamelCase" as "PascalCase". Similiarly what you call "lowerFirst" I call "camelCase"... Wikipedia agrees with you that leading capitals can be called CamelCase also.

To me, FunctionsAreLikeThis. At work variables areLikeThis. For my personal stuff i_like_underscores.

Share this comment


Link to comment
It actually depends on the language I am writing in.

I typically use CamelCase for whatever class / structs / enums and 'meta' datatype.

In C, C++, Java and C#, for methods/functions I use 'mixedCase'.
In Ruby, Python and OCaml I use 'under_scores'.

The same goes for my variables.

I also didn't realize I did this until you brought it up. This is strange behavior on my part, if you ask me...

Share this comment


Link to comment
Quote:
Original post by visage
It actually depends on the language I am writing in.


A good point. Should probably mention that in lua I exclusively use_underscores.

Share this comment


Link to comment
I always use CamelCase for types, functions and namespaces. I use lowerFirst for instances and other variables. I never use underscores, that character shouldn't exist.

Instead of using a prefix like m_foobar, I prefer to use this or equivalent to denote a member field (this.foobar).

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now