🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.language.csharp
Article #219

Re: Two basic questions

#219
From: Bob Dawson
Date: Mon, 10 Jul 2006 00:30
81 lines
3735 bytes
"Joanna Carter [TeamB]" wrote
>
> In that case, ask Rudy to fit you a guard to protecty your teeth :-)

'fraid you were going to say that ...

> I have found that following the camel case convention for variables and
> private fields makes for very easy reading, making it very obvious what is
a
> type and what is a value.

Actually I am starting to grok that, which is part of why using 'string'
rather than 'String' bugs me. I'm still mulling over fields though: order of
current preference

String mFirstName
String firstName

Both m_FirstName and _FirstName are right out.

Despite MS's guidance otherwise, using a form of RPN--but now to indicate
scope rather than type--seems reasonable to me, with

mSomeThing = private field
aSomething = method param
tSomething = local var

't' for temp, but not sure about that last one. 'm' for method variable is
what I'd want, but that's taken as member variable. May go with m, t, and
procedure level variables unmarked.

> What can get a little confusing is when you get a property with the same
> name as the type it represents.

MS's recommendations in this area are quite obviously C#-centric.

> The common advice for this is to use private/protected/internal/public for
> everything except methods which should be grouped according to functional
> area.

But the whole thing is much more complicated of course. For example

All class stuff before all instance stuff?
Constructors always before any other methods?
Methods before properties, vice-versa, or all intermixed?
And Events?
Where to nested classes go?

Whats the over all sort priority?

class stuff then instance stuff, then within those
  --visibility
      --type (field/constructor/method/properties)
          -- functional group
              -- alphabetical?

Is a nested class treated as just another declaration type, going after
fields and before constructors

> Using regions is a great help and one use I make of them is to contain
> something like an event and its related field/caller.

But events are generally public, the related field probably private--so if
you're sorting by visibility how can they be together?

> I feel that following the same style used in the MSDN docs for their
> examples makes it a lot easier for those who will look back on your
> code to understand it.

Would that the different books that MS publishes all followed a consistent
style. They don't (Richter, for axample (CLR via C#) declares strings as
String).

> I must admit I use the aliases, but I really couldn't say why I prefer
them,
> it just sort of feels better ?? :-) In any case, syntax highlighting marks
> them as reserved words

a point against them: 'string' is a type, not a reserved word like 'else'

bobD
Technical Details
Message-ID: <44b1919a@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44b0539d$1@newsgroups.borland.com> <44b160d9$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,dc12dddeb5f6ea0
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Bob Dawson" <RBDawson@prodigy.net>
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <44b0539d$1@newsgroups.borland.com> <44b160d9$1@newsgroups.borland.com>
Subject: Re: Two basic questions
Date: Sun, 9 Jul 2006 18:30:43 -0600
Lines: 83
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1807
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807
NNTP-Posting-Host: 71.32.76.154
Message-ID: <44b1919a@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1152487834 71.32.76.154 (9 Jul 2006 16:30:34 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail