    <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  :: Automatically-Generated Nightmares</title>
        <link>https://members.accu.org/index.php/journals/706</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>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 16, #6 - Dec 2004</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/journals/">All</a>

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

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

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c99/">166</a>
                    (12)
<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;Automatically-Generated Nightmares</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 December 2004 13:16:09 +00:00 or Fri, 03 December 2004 13:16:09 +00:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e22" id="d0e22"></a></h2>
</div>
<p>A student sent me the source code for a mini-project of his. It
came to about 100 printed pages of Java code, and he had a problem
with it. I started looking through the code, but it was very
difficult: there were hardly any comments, and most variable names
implied that the code was something to do with a graphical
interface but it was hard to see exactly what was going on, and
anyway the problem in question had nothing to do with the
interface. I searched in vain for the part of the code that
actually did something other than manipulating interface objects,
and wondered how on earth he can write all of this without getting
completely muddled. I thought &quot;am I such a lousy programmer that I
can only deal with small and manageable code while the new students
can write reams and reams like this?&quot; and &quot;how many hours a week is
a programmer expected to work these days to come up with all of
this?&quot; and &quot;perhaps I'd better admit my utter lack of productivity
now and find a different job&quot;. When I finally figured out roughly
how it all worked, I asked the student a question about part of the
code that I thought was more suspect than the rest, and his reply
was &quot;Oh, I don't know about that; the GUI wizard program wrote it
all for me.&quot; Ah! So THAT'S why it was so big and complicated. I
shouldn't have worried so much. Or should I?</p>
<p>There are plenty of &quot;GUI wizards&quot; and other tools that will
generate code for you, and that code will usually contain &quot;TODO&quot;
comments to show where you should add your own logic.</p>
<p>Unfortunately it seems that most programmers, after writing what
they are prompted to write, delete the &quot;TODO&quot; comment and do not
add another in its place, which means that anyone else who wants to
browse or debug the code will first have to spend considerable time
unravelling the automatically generated code to try and figure out
where the user-written code is actually located. This must add up
to an awful lot of wasted programmer time in the industry. While
some tools give you code that is relatively easy to follow when
finished, others generate such large amounts of hard-coded
graphical widget handling that you'd be pushed to find anything
else.</p>
<p>I can understand why programmers want to delete &quot;TODO&quot; comments,
especially in the light of tools that flag them up as &quot;things not
done&quot;, but I think it would be better if, instead of deleting the
whole comment, they simply delete the word &quot;TODO&quot; when they've done
it. That would leave a comment that gives some description of what
is happening and also serves to highlight where the user-written
code is to be found; as the automatically generated parts usually
have few if any comments, any comments at all would make your code
stand out. Even a complete beginner who is not skilled at writing
comments can adopt this method, and it would make things a great
deal easier for anyone who has to check their work.</p>
<p>What would be even nicer is if more of the wizards and other
rapid application development tools could promote a clearer
separation of concerns between your code and their code.
Object-oriented languages like Java support this naturally (think
of encapsulation and all the other buzzwords you know) but it's not
being used as well as it could be. Why do the tools promote
obfuscation, turning Java into a language of a much lower level
than it was designed to be?</p>
<p>Perhaps it is because they want you to spend a lot of money on
other tools to help you maintain the code. In effect, they are
creating a language of their own which gets compiled into Java and
then has to be de-compiled by their tools before it makes sense.
Java is going the same way as HTML: it was originally intended to
be written and read by humans, but now most of it is generated
automatically and can't easily be made sense of without highly
complex tools (and even then you're not guaranteed to see the
programmer's intentions). To see what I mean, take a
straightforward text editor and try to make sense of the source
code in an average Eclipse plugin. (Yes I know some of them are
better than others.)</p>
<p>The problem is that the tools are not always available. What if
you want to review some code when you don't happen to be sitting at
your most powerful computer? When you're not at any computer? When
the tool doesn't co-operate with your special disability access
software, or its layout is too complex for the size of the display
you're using? When there are license restrictions that get in the
way of your using it in the circumstances at hand? When you don't
even know what tool you're supposed to be using because someone has
handed you the code without telling you? It's understandable that
you need the right tools when compiling or testing code, but it's
rather more restrictive if you have to arrange your life around
them just to look.</p>
<p>Moreover, what if the way that you think best when you review
code does not tie in with the way the tool pushes you into
thinking? Sometimes tool designers push you into a particular way
of thinking for a good reason, but at other times they're just
being short-sighted. It reminds me of Green's Cognitive Dimensions
of Notations theory; ordinary text editors and printouts, when
applied to code that is designed for them, tend to be good at
allowing &quot;viability&quot; of the notation, avoiding the need for
&quot;premature commitment&quot;, and so on, whereas other tools don't always
do so well. While they may make some developers more effective,
others become less effective, and that's bad news when you're
collaborating.</p>
<p>If you are a user of a code-generation tool, perhaps it would be
a good idea if you put your own code in a completely different
file, and get the automatically-generated stubs to call it. This
should make it easier when the code needs reviewing, or when you
want to reuse parts of it in other projects. It also makes it
easier if for some reason you want to re-run the tool, or to run
some other tool (perhaps for a newer kind of interface) without
throwing away all of your work. If you can't do such separation,
then at least keep clear comments about which parts of the code
were written by hand, otherwise you may be in trouble later.</p>
<p>Unfortunately, for the project in question, we ended up starting
over, because I thought that this would be less effort than trying
to figure things out from the forest of automatically-generated
code that was camouflaging the parts of interest. It shouldn't have
been that way.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
