Re: Commenting source code is for amateurs

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

From: clintonG (csgallagher_at_REMOVETHISTEXTmetromilwaukee.com)
Date: 09/23/04


Date: Thu, 23 Sep 2004 13:37:58 -0500

Professionals also use short paragraphs and white space when writing ;-)

-- 
<%= Clinton Gallagher, "Twice the Results  -- Half the Cost"
         Architectural & e-Business Consulting -- Software Development
         NET csgallagher@REMOVETHISTEXTmetromilwaukee.com
         URL http://www.metromilwaukee.com/clintongallagher/
"Brian Henry" <brianiupmsdn@newsgroups.nospam> wrote in message
news:uNjvjyQoEHA.3324@TK2MSFTNGP10.phx.gbl...
> Comments and massive documentation are done in professional software
> development... if you don't explain what a function does in comments and
> documentation how will you remember what it does after writing another 400
> functions? most likely you will forget what 80% of them do by that point
and
> will need some kind of reference.. and when someone else starts working on
> your code also in a team they definatly need reference points to look at
> such as comments, markers, and documentation  to even begin to understand
> what is going on in code especially on a massive scale like 100,000+ lines
> of code... so saying comments are useless, pointless, or anything else
> similar to that is just stupid. people may think they are "1337" just
> because they can read code without comments, but if you had a 100 line
> function and had no clue what it did uncommented would you want to step
> through it line by line to determine exactly what it does, what it effects
> and what it may return? I doubt you would want to waste that time.
>
>
> "Marian F." <NoSpam@NoSpam.Net> wrote in message
> news:ufOf2APoEHA.3988@tk2msftngp13.phx.gbl...
> > The 12 years old genius function to count english words in a sentence:
> >
> >   ' This is my function to count english words in your string
> >   ' s is the string with your words to be counted
> >   ' Returns an integer as the number of words found
> >   Public Function iCW(ByVal s As String) As Integer
> >     ' We start declaring the variable to count words
> >     Dim c As Integer
> >     ' This is the variable used in the for next loop
> >     ' to check every char in your string s
> >     Dim i As Integer
> >     ' Now check all chars in your string s
> >     ' Starts with the 1st char, i = 1
> >     '    up to last char, s.Length
> >     For i = 1 To s.Length
> >       ' check is the char is a space
> >       If Mid(s, i, 1) = " " Then
> >         ' if it is a space, increment the word count WordCount
> >         c += 1
> >         ' if it is not, then do nothing
> >       End If
> >       ' continue to check words until no more
> >     Next
> >     ' return the word count, c
> >     ' after adding 1 to compensate for the word before the first space
> >     Return c + 1
> >   End Function
> >
> >
> > The semi-pro solution to count english words in a sentence:
> >
> >   Public Function WordCount(ByVal Text As String) As Long
> >     While InStr(Text, "  ") ' remove double spaces
> >       Replace(Text, "  ", " ")
> >     End While
> >     If Replace(Text, " ", "") = "" Then Return 0 ' only spaces
> >     Dim WordCount As Long
> >     For i = 1 To Len(Text)
> >       If Mid(s, i, 1) = " " Then WordCount += 1
> >     Next
> >     Return WordCount + 1
> >   End Function
> >
> > The pro solution is the same as the semi-pro but without comments
> >
> > MF
> >
>
>


Relevant Pages

  • java.io.FileOutputStream misbehavior
    ... is it right that when writing a file, ... one or two byte get written per char? ... For example you save a String with about 40kbyte into a file. ... When putting a single umlaut in the String, ...
    (comp.lang.java.help)
  • Re: Null terminated strings: bad or good?
    ... char* data; ... Ease of IO (writing to/fro disk files, ... The writing from a string can be done ...
    (comp.lang.c)
  • Re: Null terminated strings: bad or good?
    ... char* data; ... Ease of IO (writing to/fro disk files, ... The writing from a string can be done ...
    (comp.lang.c)
  • Re: how to convert char* to File *
    ... I have a long string in char * and want to convert it to a File * ... "Debugging is twice as hard as writing the code in the first place. ... not smart enough to debug it." ...
    (comp.lang.c)
  • Re: How to add thousand separators
    ... First, this code is obsolete as written, because char is a dead data type and should not ... Note that both of these should be stored as string resources since they might need to be ... 18 digits for any reason. ... you have made a VERY SERIOUS DESIGN ERROR. ...
    (microsoft.public.vc.mfc)