    <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  :: Thinking Aloud</title>
        <link>https://members.accu.org/index.php/articles/1084</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">CVu Journal Vol 12, #6 - Dec 2000</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/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/c123/">126</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;Thinking Aloud</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 December 2000 13:15:42 +00:00 or Sun, 03 December 2000 13:15:42 +00:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="sect1" lang="en">
<div class="titlepage">
<h2><a name="d0e18" id="d0e18"></a>Epiphanies 'R'
Us</h2>
</div>
<p>I have to confess that I have a number of weaknesses where C++
is concerned:</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>I use C style <tt class="type">char</tt> arrays instead of C
strings. This is probably because I did not like the original
string library.</p>
</li>
<li>
<p>I do not use the iostreams library. I am currently reading
Angelika Langer's book on IOStreams and Locales (not for the faint
of heart) to see if that will change my dislike of it. More about
this in a future column, when I have finished reading the book.</p>
</li>
<li>
<p>I rarely use exceptions. I am not opposed to them in principle,
but I think they should be reserved for exceptional situations and
not used as a routine method of catching errors. I understand that
people were happy to have an alternative to the woefully inadequate
<tt class="methodname">setjump()</tt>/<tt class=
"methodname">longjump()</tt> of the C library. I think though that
a lot of people went overboard on this issue.</p>
</li>
</ol>
</div>
<p>Recently, though, I have re-evaluated my position on item one -
C++ strings v. C <tt class="type">char</tt> arrays.</p>
<p>The cause of this was a look through the email correspondence
file relating to bugs in my new game, <i class="citetitle">Age of
Adventure</i>. I did a quick analysis of the underlying causes of
the bugs and came to the conclusion that somewhere between a third
and a half of all the bugs that got through into the production
version were related to buffer overflows. Not only that, the bugs
were mostly related to assembling text for transmission to the
players.</p>
<p>This was pretty shocking. I had no idea the problem was so
prevalent. I even went back and counted again, because I thought I
must have counted some bugs twice. So I picked up Bjarne's
'<i class="citetitle">C++ Programming Language</i>' and worked
through the chapter on strings. The lesson was underlined by a
bunch of security related bug reports from the open source movement
that came out at about the same time. Virtually every single one of
the bugs was a buffer overflow bug - usually related to user
input.</p>
<p>The upshot of this was that I was finally convinced that I
should start using C++ strings, which, of course, do their own
memory management, instead of C <tt class="type">char</tt> arrays.
Unfortunately, the current stuff is too far gone to change it at
this stage, but all new projects will use strings from now on. And
in the meantime I will continue wresting with a stubborn bug that I
strongly suspect is a buffer overflow deep in the bowels of the
program...</p>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e62" id="d0e62"></a>Open Source
software</h3>
</div>
<p>I mentioned earlier that there were a series of bugs discovered
in open source software. It was unfortunate that this happened just
after two of the larger Linux distributors (Red Hat and SuSE) had
launched new versions. However, I had a graphical example of the
difference in proprietary software treatment of reported bugs and
that of open source software.</p>
<p>Without exception fixes for the open source bugs were available
within days, if not hours, of the bug reports being filed. Very
impressive.</p>
<p>While this was going on we were tracking down a bug in Borland's
<span class="productname">C++ Builder</span>&trade; 5 library. Now
I have to say, this was not an easy process. I wrote the original
code, and was sure it was a mistake on my part. I looked at the
code on and off for nearly a month, but could not see what I was
doing wrong. At this stage I decided that I needed someone else to
look at it - I was probably reading what I meant to code, rather
than what I had actually coded.</p>
<p>I sent the code off to another programmer to look at and he
worked on it for nearly three weeks before he finally isolated the
bug and was able to prove that it was a bug in the library code.
OK, so there was probably some delay because I was convinced that
it was my error and insisted he keep investigating my code for
longer than he would have done if left alone. Even so this was a
substantial use of our resources. Once I was convinced it was a
library bug it took nearly a week to construct a sample program
that displayed the problem. Even for that you had to run the
program under the debugger to see the incorrect memory access in
the destructor.</p>
<p>So we spent all this time finding a bug in Borland's software,
more time constructing a program that would enable them to identify
the bug, and then we sent a report off to them. A couple of days
later we got a note accepting that it was a bug in their library.
And then...</p>
<p>Nothing! No patch, not even a work around, and as I write this
it is now nearly two months since we reported the bug.</p>
<p>Fortunately this is an internal tool, and the bug only affects a
destructor that is called immediately before the program
terminates. If it ran under Linux or another Unix variant it would
not be too much of a problem because the operating system would
clean up the undeallocated memory. Unfortunately Windows leaves the
memory allocated, so people using the program have to reboot
periodically to reclaim the lost memory.</p>
<p>Why was I so convinced the error was mine? Well that's a bit
difficult to explain. I guess it is to do with the fact that I am
very wary of blaming problems on any software other than my own. It
is my experience that when a bug rears its ugly head given even a
slim fraction of a chance most programmers will blame any other
software that is around other than their own.</p>
<p>I have had to virtually prove it could not be other software so
often in order to force people to do serious debugging on their
programs that I suspect I am probably leaning in the opposite
direction.</p>
<p>It is desperately important that people should be able to trust
their tools. Software development is built on trust - the trust
that the tools you are using to build your applications are not
flawed. The problem is that once a problem is found with the tools
the trust breaks down and when anything goes wrong the natural
reaction is to blame something that has already been found to be at
fault.</p>
<p>It matters not that the application programmer's work has had
many more bugs than the tools have shown, it is easy and natural to
blame the tools for any further faults found. Fortunately, I wrote
this program and I am aware of the problem, so I can be stern with
myself about such backsliding.</p>
<p>The fact remains, though, that if this had been a program for
sale it would have been a disaster - months of delay in putting the
product on the market, possibly having to completely rewrite it.
Not good.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e92" id="d0e92"></a>How do I become a
programmer?</h3>
</div>
<p>I do not know about other people, but every few weeks an e-mail
appears in my mail box from one or other of our customers - usually
the younger ones asking either '<span class="emphasis"><em>How do I
become a programmer</em></span>' or '<span class="emphasis"><em>How
do I become a game designer</em></span>'.</p>
<p>The first question is not as easy as it sounds, because the
people asking it come from a wide variety of different countries.
Most are American, some are from the UK, but I have been asked by
customers from countries as far apart as Australia, Brazil, Hong
Kong, Malaya, Russia and Turkey.</p>
<p>Eventually I got round to pulling some of the answers to 'How do
I become a programmer' together on my website. If you regularly get
asked, please feel free to 'borrow' material from my answers for
your own use. The URL to access it is at <a href=
"http://www.ibgames.net/alan/society/programmer.html" target=
"_top">http://www.ibgames.net/alan/society/programmer.html</a>.</p>
</div>
<div class="sect2" lang="en">
<div class="titlepage">
<h3><a name="d0e110" id="d0e110"></a>Winding up</h3>
</div>
<p>Finally, if you have not yet read my Secretary's report in this
issue, I would urge you to do so, not merely because it is a
scintillating example of journalistic excellence that will delight
and entertain you, but because it deals with the subject of
software patents. What happens to the rules governing software
patents in the next few years is going to have a major effect on
the way in which we work in the future. Do not miss out on the
opportunity to have your say.</p>
<p>Have fun programming, may all your bugs be small ones.</p>
<p class="c2"><span class="remark">Editorial Note</span></p>
<p class="c2"><span class="remark">A couple of days ago, I read a
news report on the subject of patents. That report stated that the
decisions on changing the European Patent position would be taken
before the closure date for public comment. I hope I am mistaken
because this issue is far too serious to take lightly.</span></p>
<p class="c2"><span class="remark">I am seeing increasing evidence
that US patent law and its interpretation is a major disaster in
the making. The problem as I see it is that a mechanism for
rewarding inventors for revealing trade secrets concerned with
physical devices and processes for production has been subverted to
handle other kinds of intellectual property.</span></p>
<p class="c2"><span class="remark">Let me give you an
example.</span></p>
<p class="c2"><span class="remark">Currently speech recognition
software is not quite up to the standard where I feel comfortable
with using it for dictation. However, it is very good for
command-based work such as accessing a menu, highlighting text etc.
In fact almost everything that I previously did with a mouse can
now be done with spoken commands leaving my hands in place on my
keyboard. Should I be allowed to patent that process? How is it
different from Amazon.com's 'one click shopping'?</span></p>
<p class="c2"><span class="remark">Francis</span></p>
</div>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
