Re: Naming Conventions dot net/csharp

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mark Broadbent (no-spam-please_at_no-spam-please.com)
Date: 04/16/04


Date: Fri, 16 Apr 2004 16:06:44 +0100

yeah thanks. Id seen that one before but feel it is missing an awful lot
(such as control, private members etc). The other good link Id found was
http://www.irritatedvowel.com/Programming/Standards.aspx
but that doesnt give a prefix for each control (although it states name them
in Hungarian style).
I'd hoped that for something I consider important that a "bible" would exist
somewhere?

personally I would prefer the Editor to apply a formatting template to the
variable /class/ interface/ control etc.
e.g I create a texbox it creates name txtTextbox1 where txt is implied by
the control and cant be removed -and the camel casing cannot be changed
although the text "Textbox1" can. Or a private class variable is created so
_ is implied and is prefix to (and cant be changed) the variable text (which
is also enforced to be Pascal case.
I think this would speed development up hugely. For companies that enforce
there own standards, templates could be modified....The option to turn off
this behaviour could also exist.
Whether or not this is in Whidbey I will live in hope

-- 
-- 
Br,
Mark Broadbent
mcdba , mcse+i
=============
"Jon Skeet [C# MVP]" <skeet@pobox.com> wrote in message
news:MPG.1ae9f1a59fca725498a6d1@msnews.microsoft.com...
> Mark Broadbent <no-spam-please@no-spam-please.com> wrote:
> > stupid question time again to most of you experts but this is something
that
> > continually bothers me.
> > I am trying to get into the habit of naming variables and controls in an
> > assembly as per convensions. The thing is that Ive never really get the
full
> > reference to check against.
>
> The main one is
>
> http://tinyurl.com/2cun
>
> > Ive seen a couple of articles, but there always seems to be a bit
missing. I
> > also always seem to run into conflicting convensions both in code
samples
> > themselves or between different articles.
> > For instance, in one article it stated that class private and protected
> > variables should be named underscore+camelcase e.g. _likeThis
> > But I never seem to come across this in peoples' code samples (whether
MS
> > employee or not).
>
> Protected variables need to follow a public naming convention, but for
> private variables and methods you can use your own convention.
> Personally I don't use any prefixes or anything, but lots of others do.
>
> > Another ambigious thing I have noticed (even steming back to VB
conventions)
> > is that when naming controls, I dont seem to find a standard for
radiobutton
> > (i.e. something like rdoMyButton).
> >
> > So in brief what I am looking for is.....
> > Naming standards for everything throughout an Assembly. Additionally
full
> > standards as far as is possible for controls.
>
> Well, MS only specify *public* naming conventions, but you'll find
> plenty of differing opinions about other stuff. It's important that you
> or your company standardises on a naming convention for private stuff,
> but it doesn't matter too much what that convention is.
>
> > Also could someone clarify
> > whether class Naming convention is applied to the design time element,
the
> > instance or both.
>
> Not sure what you mean here - could you clarify?
>
> > Finally could someone give me conventions for the solution
> > explorer elements such as the code files *.cs
>
> That's really up to you/your company - it won't make much odds to the
> outside world. Actually, that's not quite true - if you're writing a
> library which implements a certain namespace, it's conventional to name
> the assembly by the namespace, eg Foo.Bar.dll for namespace Foo.Bar.
>
> -- 
> Jon Skeet - <skeet@pobox.com>
> http://www.pobox.com/~skeet
> If replying to the group, please do not mail me too


Relevant Pages