[dba-VB] ControlChars in C#

Shamil Salakhetdinov shamil at users.mns.ru
Wed Mar 26 12:39:35 CDT 2008


Hi Gustav,

<<<
But let's see - habits change.
>>>
Yes, they do change... :)

<<<
One more is to prefix private variables with an underscore. That is so weird
to me, but I can see the idea so I try ...
>>>
... and this is what also for me a "habit change" shift after 10+ years
programming using Hungarian Notation and LRNC but this now I do use this
underscore prefixing subconsciously, and  it's useful habit:

- private variables are underscored prefixed;
- parameters are started with lower case char;
- public variables (fields)/properties/methods are named using CamelCasing

And one can instantly see from the code what scope/origin this or that
variable/parameter/property/method has...

--
Shamil
 
-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, March 26, 2008 7:40 PM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] ControlChars in C#

Hi Shamil

I'm listening carefully ...

I see your point about the local variables. Seems I should reconsider ... I
noticed that if in VS you change the name of anything, the editor tries to
locate all occurrences of this and suggest to rename ... and that kills one
of the arguments for using local variables. And if the compiler anyway
creates its own variables on the fly why should I bother? I didn't know
that.

As for the use of the optional curled brackets I'm not so sure. For example
if you choose to use refactoring to encapsulate a local variable in a class,
the refactoring engine tosses curled brackets all over, but I found it
easier just to let them stay rather than going through a lot of manual
editing. But let's see - habits change.

One more is to prefix private variables with an underscore. That is so weird
to me, but I can see the idea so I try ...

/gustav

<<< tail skipped >>>




More information about the dba-VB mailing list