A
Author #1
Maybe naming isn't a big deal for many of you, but this has been
bothering me for a while. I like to be consistent in naming. But,
sometimes I think it is really hard to be consistent.
I use camelCase for variables like so:
private string firstName;
private string lastName;
I use PascalCase for class names and method names:
public class Employee
{
public DataTable GetEmployeeDetails(int employeeId)
{
}
}
This is fine and consistent, but I see that in the examples of many
articles, they use Hungarian notation for IDs of server controls such
as buttons (e.g. btnSave, btnCancel), and the click event handlers
will then have names like btnSave_Click, btnCancel_Click.
I am following their examples and doing this, too. But, then these
event handler names conflict with my intention of using PascalCase for
method names. If I substitute btnSave_Click with SaveEmployee, then
it does not seem to be as self-explaining as btnSave_Click because
btnSave_Click tells you it is a click event handler, whereas
SaveEmployee does not.
Maybe I should use camelCase for method names just like in java, but
MS coding standards recommend using PascalCase.
See how confused I am? Any consistent coders? Thank you.
bothering me for a while. I like to be consistent in naming. But,
sometimes I think it is really hard to be consistent.
I use camelCase for variables like so:
private string firstName;
private string lastName;
I use PascalCase for class names and method names:
public class Employee
{
public DataTable GetEmployeeDetails(int employeeId)
{
}
}
This is fine and consistent, but I see that in the examples of many
articles, they use Hungarian notation for IDs of server controls such
as buttons (e.g. btnSave, btnCancel), and the click event handlers
will then have names like btnSave_Click, btnCancel_Click.
I am following their examples and doing this, too. But, then these
event handler names conflict with my intention of using PascalCase for
method names. If I substitute btnSave_Click with SaveEmployee, then
it does not seem to be as self-explaining as btnSave_Click because
btnSave_Click tells you it is a click event handler, whereas
SaveEmployee does not.
Maybe I should use camelCase for method names just like in java, but
MS coding standards recommend using PascalCase.
See how confused I am? Any consistent coders? Thank you.