Re: Decompiler.NET reverse engineers your CLS compliant code

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: One Handed Man \( OHM - Terry Burns \) ("One)
Date: 09/14/04


Date: Tue, 14 Sep 2004 08:09:33 +0100

My view is that in essence, comments should serve to explain code which
either has some quirk in it to compensate for an inadequacy or issue with
classes which it interacts with or is dealing with some particularly complex
or intricate algorithm.

Otherwise, my beleif is the same as yours, well written code needs little
explaination when being read by someone competent.

-- 
OHM ( Terry Burns )
 . . .  One-Handed-Man . . .
If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@msn.com> wrote in message
news:ud4QOLemEHA.648@tk2msftngp13.phx.gbl...
> > Hm, yeah, that doesn't even count.  It's all throw-away stuff.
> > Anyone that thinks "comments" are optional, Is optional.  But
> > it's your mess so what I think doesn't matter.
> You miss understood my statement! I did not intend to imply that comments
> are optional. I actually meant that a lot of comments are redundant. If
you
> label (name) the code for what it does, then I (in addition to Fowler &
> Kerievsky below) don't see a real need for the comment. Fowler also
suggests
> that if you have a block of code with a comment preceding it, that you
> should move the block of code to its own method, with the comment as the
> name of the method.
>
> Another example is putting a comment on a variable or parameter
declaration.
> If you simply pick a fuller name for the variable or parameter, do you
> really need a comment on it?
>
> For example, I have a routine that needs two date variables:
>
> ' with comments
>     Dim d1 As DateTime    ' the start date
>     Dim d2 As DateTime    ' the ending date
>
> ' without comments
>     Dim theStartDate As DateTime
>     Dim theEndingDate As DateTime
>
> If you simply name the first variable as theStartDate do you really need a
> comment suggesting the value is the start date?
>
> Consider seeing d1 & d2 used 5 times in your routine, would the code be as
> readable as using theStartDate & theEndingDate?
>
> Would you need comments when you use d1 & d2?
>
> Would you need comments when you use theStartDate & theEndingDate?
>
> In other words "Human-Readable Code" or as Fowler states in Refactoring
"Any
> fool can write code that a computer can understand. Good programmers write
> code that humans can understand".
>
> You may want to read (& apply the ideas in) Martin Fowler's book
> "Refactoring" and Joshua Kerievsky's book "Refactoring to Patterns" both
> from Addison Wesley to have a better understanding of my statement.
>
> Hope this helps
> Jay
>
> <hel@40th.com> wrote in message
> news:eggGCodmEHA.2140@TK2MSFTNGP11.phx.gbl...
> > Mr X.
> > >> comments.  Code without comments is rather worthless.
> >
> > JH [Mon, 13 Sep 2004 15:30:37 -0500]:
> > >In my experience well written code shouldn't need comments!
> >
> > Well, see, that's in your experience, which obviously has never
> > had to deal with SOMEONE ELSE's "well-written code" (haha).
> >
> > >' adopted to VB.NET
> > >    Public Shared Sub Main()
> >
> > Hm, yeah, that doesn't even count.  It's all throw-away stuff.
> > Anyone that thinks "comments" are optional, Is optional.  But
> > it's your mess so what I think doesn't matter.
> > -- 
> > 40th Floor - Software  @  http://40th.com/
> > iPlay : the ultimate audio player for iPAQs
> > mp3, ogg, mp4, m4a, aac, wav, and then some
> > w/surround, xfeed, reverb - all on your ppc
>
>


Relevant Pages