Re: Code Performance

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

From: Jay B. Harlow [MVP - Outlook] (Jay_Harlow_MVP_at_msn.com)
Date: 08/22/04


Date: Sun, 22 Aug 2004 10:59:04 -0500

Herfried,
If you read "Refactoring - Improving the design of Existing Code" by Martin
Fowler from Addison Wesley http://www.refactoring.com/

Martin would suggests that too many comments is a "bad smell" in your code.
A "bad smell" is a section of cod that needs to be improved. Specifically
Martin states in reference to a long methods:

   "A heuristic we follow is that whenever we feel
    the need to comment something, we write a method
    instead. Such a method contains the code that was
    commented but is named after the intention of the
    code rather then how it does it".

Basically if you have a long method where you have a comment every 10 or 15
lines, that each of those 10 or 15 lines should be its own method, where the
name of the method is the comment.

Martin is not suggesting you do not put comments before methods that explain
what the method does, what it expects & what it returns. He is referring to
comments within the method bodies themselves.

Hope this helps
Jay

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:2op3mbFct4c3U4@uni-berlin.de...
> * "Cor Ligthert" <notfirstname@planet.nl> scripsit:
> >> I always get praised for my code being easily understood so there is
> >> no worries there. Plus I comment a lot.
> >
> > When your code is easily to understood there is no need for commenting.
>
> Aren't comments /part of/ the code?
>
> :-)
>
> --
> Herfried K. Wagner [MVP]
> <URL:http://dotnet.mvps.org/>



Relevant Pages

  • Re: Desperate fishwives
    ... Martin said the following on 22/04/2008 21:43: ... The smell of stale fish lingers on long after she had gone? ... Blondes at 1.51 more your type? ...
    (uk.media.tv.misc)
  • Re: Courgettes
    ... >>Marrow and roasted garlic soup it is ... > I'll be able to smell it :-) ...
    (uk.rec.gardening)
  • Re: OT: That Summer aroma
    ... Martin said the following on 11/05/2008 09:59: ... But it's finally summer and we open all the windows and is it the smell of Jasmine coming in from the garden, ... Buy a packet of Zaluzianskya (Night Phox) and you can have the evening smell of sweet cigarettes. ...
    (uk.media.tv.misc)
  • Re: Can I sell my D8 Architect?
    ... >>concept of property is in jeopardy. ... Do I smell an insult here? ... Martin ...
    (borland.public.delphi.non-technical)