    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: Comments</title>
        <link>https://members.accu.org/index.php/articles/822</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>




<div class="xar-mod-head"><span class="xar-mod-title">Letters to the Editor + CVu Journal Vol 17, #4 - Aug 2005</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c184/">Journal Columns</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c186/">LettersEditor</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/articles/c95/">174</a>
<br />

                                            <a href="https://members.accu.org/index.php/articles/c186-95/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/articles/c186+95/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;Comments</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 08 August 2005 05:00:00 +01:00 or Mon, 08 August 2005 05:00:00 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e20" id="d0e20"></a></h2>
</div>
<p class="c3"><span class="remark">Not that huge a postbag this
edition, but something in Pete Goodliffe's Professionalism article
#32 did catch the eye of Chris Smith.</span></p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e25" id="d0e25"></a>From Chris to
Pete</h2>
</div>
<p>I have just read your article 'Professionalism in Programming
#32' (C Vu, June 2005). You invited us to voice our disagreements,
so here it is: I disagree. :-)</p>
<div class="blockquote">
<blockquote class="blockquote">
<p>My (single) complaint is with your improved version of the
'greatest_common_divisor function. To quote your article: Try
feeding it a negative argument. This is a more robust (and more
efficient) version written in C++:</p>
<pre class="programlisting">
    int greatest_common_divisor(int a, int b)
    {
         a = std::abs(a);
         b = std::abs(b);
         ...
</pre></blockquote>
</div>
<p>My complaint is that you are enforcing restrictions on the input
which are not visible to the 'clients' of your function - you are
effectively saying &quot;<span class="quote">my function can't handle
negative numbers, so I will silently convert them to positive
numbers</span>&quot;. (Granted, you could detail this restriction in
comment, but that's not the point.)</p>
<p>I would have preferred the following:</p>
<pre class="programlisting">
unsigned int greatest_common_divisor(
     unsigned int a, unsigned int b)
</pre>
<p>That clearly states that you should not call this function with
negative values. (And, if you do the compiler will warn you.)</p>
<p>Now I invite you to disagree with <span class=
"bold"><b>me</b></span>. :-)</p>
<p>Chris Smith</p>
</div>
<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e53" id="d0e53"></a>Pete
Replies</h2>
</div>
<p>Firstly, thanks so much for taking the initiative (and the time)
to reply to the challenge I laid down in this article. Any writer
really appreciates feedback! For years I've been trying to provoke
some kind of response in my articles (either in letter form, or on
accu-general) so it's great that #32 has provoked people to think
and reply.</p>
<p>Also, well done for using your brain and disagreeing with what I
wrote. Too many people fall into the &quot;mindlessness trap&quot; when
reading books, magazines, even stuff online. You must always filter
what you read through your own knowledge and understanding, and
only accept what's definitely useful. Just because something is in
print, that doesn't mean it's gospel (I know that some of the stuff
I've written over the years has been drivel, and no one's
challenged me about it!).</p>
<p>So, to your specific point: I understand what you're getting at,
but (within my granted freedom to do so) I disagree with you! At no
point did I state that a negative argument is invalid input.
Indeed, it is most definitely a valid form of input. However,
negative input would have caused an infinite loop in the original
(typographically challenged) version of the GCD function.</p>
<p>The corrected version accounts for this by converting all input
values to positive integers before working on them. The side effect
of this is to only ever return positive GCD values but, more often
than not, that is what's required anyway.</p>
<p>Of course, if negative values were invalid input then it's
preferable to make this explicit in the code by careful choice of
data type.Thanks again for your response. I hope my future columns
elicit the same level of response!</p>
<p>Pete Goodliffe <i><span class="remark">Do you have any points
you wish to be raised about anything to do with C Vu? If so, please
just drop me a line - <tt class="email">&lt;<a href=
"mailto:cvu@accu.org">cvu@accu.org</a>&gt;</tt>.</span></i></p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
