I understand the reason to camel case variable names, but I've always wondered why you would camel case a method name? why is it toString() and not ToString()? What purpose does it serve?
It's just a convention. Like all conventions they only serve to, in the minds of their creators, make code easier to read and maintain.
Because to be consistent you'd have to capitalize the first letter of every method name, and then you have to hit the Shift key that many more times in a day.
I don't think there is any reason, these are just conventions and everyone might have his own.
If you want a function
write();
that takes less effort (one less SHIFT keypress) than
Write();
However, if you're writing to a file, you need to distinguish the words. Hence
writeToFile();
is marginally more efficient (and still consistent with the first example)
Usually you tend to follow the one that your framework uses. So Java developers tend to use lowercase to start, and .NET developers tend to use uppercase to start.
A lot of conventions say you capitalize the first letter of types (classes, structs, enums, etc.), and use lowercase otherwise (functions, members, etc.).
If you follow that convention, you can then tell just by looking that MyStruct.MyType
refers to a nested type, and MyStruct.myData
refers to some form of data, and MyStruct.myFunc()
refers to a function call.
If you haven't already read the wikipedia page, it contains everything you could ever possibly want to know on camel case, including its history.
CamelCase (also spelled "camel case") or medial capitals is the practice of writing compound words or phrases in which the elements are joined without spaces, with each element's initial letter capitalized within the compound.
And
One theory for the origin of the camel case convention holds that C programmers and hackers simply found it more convenient than the standard underscore-based style.
C programmers lazy? I doubt that very much.
We use lower-case on the first letter to save a little ink in our printouts.