This post has been edited by Vermiculus: 17 June 2010 - 05:47 AM
CamelCase or PascalCaseWhich is Better?
25 Replies - 4370 Views - Last Post: 20 June 2010 - 04:26 PM
#1
CamelCase or PascalCase
Posted 16 June 2010 - 01:16 PM
Replies To: CamelCase or PascalCase
#2
Re: CamelCase or PascalCase
Posted 16 June 2010 - 01:19 PM
#3
Re: CamelCase or PascalCase
Posted 16 June 2010 - 01:20 PM
I prefer:
Class names: uppercase + camel case
functions: lower case+ camel case
#4
Re: CamelCase or PascalCase
Posted 16 June 2010 - 01:53 PM
#5
Re: CamelCase or PascalCase
Posted 16 June 2010 - 01:56 PM
Well not 100% true, at times I catch myself using them when writing in MSSQL.
For code though I prefer camel casing personally, it's just easier for me to read and look at.
#6
Re: CamelCase or PascalCase
Posted 16 June 2010 - 02:03 PM
#7
Re: CamelCase or PascalCase
Posted 16 June 2010 - 04:56 PM
double currentTime_s = 130; double currentTime_min = currentTime_s / 60.0; double totalTime_s = endTime_min - startTime_s; // spot this error a mile away ;)/>
#8
Re: CamelCase or PascalCase
Posted 16 June 2010 - 05:44 PM
#9
Re: CamelCase or PascalCase
Posted 17 June 2010 - 02:12 AM
camelCase starts as KYA said with a lower case letter.
PascalCase starts with an upper case letter, so the poll should have looked like:
camelCase: addressTextBox
PascalCase: AddressTextBox
Hungarian: txtAddress (Not sure about this)
#10
Re: CamelCase or PascalCase
Posted 17 June 2010 - 03:13 AM
Quote
This is a common misconception and it gives Hungarian notation a bad name. Something like this:
String strAddress = new String("10 Leafy St");
Here the type (String) tells you it is a string or text. Putting that information in the variable name as well is just clutter.
Hungarian notation is useful for keeping track of units or relative offsets. Is that mouse coordinate relative to the screen or the window?
#11
Re: CamelCase or PascalCase
Posted 17 June 2010 - 03:14 AM
Vestah, on 17 June 2010 - 01:12 AM, said:
camelCase starts as KYA said with a lower case letter.
PascalCase starts with an upper case letter, so the poll should have looked like:
camelCase: addressTextBox
PascalCase: AddressTextBox
Hungarian: txtAddress (Not sure about this)
Yeah the OP got it wrong which is why I didn't vote and just replied with correct casing lol
#12
Re: CamelCase or PascalCase
Posted 17 June 2010 - 05:53 AM
Vestah, on 17 June 2010 - 03:12 AM, said:
camelCase starts as KYA said with a lower case letter.
PascalCase starts with an upper case letter, so the poll should have looked like:
camelCase: addressTextBox
PascalCase: AddressTextBox
Hungarian: txtAddress (Not sure about this)
Yes, there was a problem with the poll. I was reading a little article-type-thing about this earlier yesterday, and didn't do much further research on it. but Wikipedia did confirm the CamelCase starts every word with a capital (if it's a class/struct/etc) and starts only the first word with a lower (if it's a parameter/variable/etc). So it seems that Pascal Case (or Pascal style as Wikipedia calls it) is only the subset of CamelCase where the first letter is not capitalized.
Hungarian notation is the one with the short abbr. at the beginning (txtAddress). My fault; I have revised the poll. Also added a question concerning underscores. I say burnThem.
http://en.wikipedia....ming_convention
http://en.wikipedia....garian_notation
#13
Re: CamelCase or PascalCase
Posted 17 June 2010 - 06:22 AM
#14
Re: CamelCase or PascalCase
Posted 17 June 2010 - 06:27 AM
ClassNames
variableAndMethodNames
CONSTANT_NAMES
Hungarian notation gets added in whenever it clarifies things. (I would never use the example in your poll though)
Particularly in unit tests I do things like:
testCustomSort_arrayWithDuplicates
Basically, I use whatever convention makes my code easier to understand.
#15
Re: CamelCase or PascalCase
Posted 17 June 2010 - 07:35 AM
|
|

New Topic/Question
Reply



MultiQuote







|