    <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  :: For Discussion</title>
        <link>https://members.accu.org/index.php/articles/887</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 11, #4 - Jun 1999</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/c131/">114</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;For Discussion</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 03 June 1999 13:15:31 +01:00 or Thu, 03 June 1999 13:15:31 +01:00</p>
<p><strong>Summary:</strong>&nbsp;</p>
<p><strong>Body:</strong>&nbsp;<div class="section" lang="en">
<div class="titlepage">
<h2><a name="d0e18" id="d0e18"></a></h2>
</div>
<p>I wonder whether this would make an interesting discussion topic
in C Vu? I've been writing a program for a company that produces
monitoring and control equipment for paper mills. Early versions
were relatively simple (IMNSHO always a good idea if one wants a
successful project!). One of the main features was the ability to
display graphs of raw data, either current data or from archive
files.</p>
<p>To assist this I made a 'graph' component. To keep my thinking
clear, I implemented this as a small class hierarchy. The base
class could draw x- and y-axes and plot the data. A derived class
knew about file formats and could also step back and forth through
archives. A further derivation knew a small amount about two other
components (grids that tabulated details, including the graph
cursor position), sufficient to send messages to these components
to alert them to significant changes.</p>
<p>All well and good, I thought. Indeed, when the company produced
an extended file format that added the &quot;smoothed and spiky&quot;
versions of the raw data, little work was required to allow users
to select these displays.</p>
<p>But when designing a class hierarchy, I suspect it helps if one
has a crystal ball handy, to know what kinds of specialisation will
be needed. [fade up Jaws music]</p>
<p>At this point the file formats were further extended, and two
new displays were required. They both needed a histogram style
instead of the pixel-by-pixel graph of the earlier ones. There were
some other aspects they had in common, and they still needed to
communicate with the two other components.</p>
<p>So my earlier inheritance tree needed (or so I believe) to be
turned upside down. I was thankful that the earlier inheritance was
essentially an internal convenience and that this wasn't a team
project where other programmers might be already using these
classes. Adding the new graphs, let's call them MD and CD graphs,
my new derivation looked like:</p>
<pre class="literallayout">
TGraph0
   |
TGraph1
   |
TGraph2
   |
TMainGraph-------------------------------------
   |                                          |
TRawGraph TSmoothedGraph TSpikyGraph          |
                                              |
                                          TXdGraph
                                         /       \
                                    TMdGraph   TCdGraph
</pre>
<p>But now, (damn, if only that crystal ball weren't so murky) I
need to display trend information in yet another window. In some
respects this is unlike any of the other graphs. For example,
instead of handling data from a single file it collates data from
many files. Therefore I suspect I should derive it from TGraph2.
Yet in some other respects it is very similar to TCdGraph,
especially in the way that it scrolls, reacts to tabset changes,
etc.</p>
<p>At the time of writing I haven't decided how to solve this, but
I suspect I shall use rather more copy&amp;paste than I like.
:-(</p>
<p>I would be interested to hear of other readers real-world
experiences, to know if these kind of hierarchy design problems are
common and whether I'm overlooking something.</p>
<p>Of course, when you're trying to get nails into wood, it
probably helps to know whether there's a nail-gun around or even a
hammer. So some may wonder what language I'm using, and others may
already suspect that those 'T' lead-ins are a give-away! Yes, I'm
using Borland Delphi (and I'm still delighted with the resulting
productivity). I'm sorry if some readers feel that makes this
off-topic, but I do think that when you're implementing only on MS
Windows, if you're familiar with C++ you owe it to yourself to take
a look at Delphi (especially so if you've already done some Pascal,
but even if you haven't the learning curve isn't steep). I've also
bought C++ Builder, and prefer C++ to Pascal, yet I prefer Delphi
to C++ Builder, somehow it feels cleaner.</p>
<p>Yes, unlike C++, Delphi doesn't have multiple inheritance, and I
suspect that might be relevant here. But if I were implementing
this in Java (as indeed I may eventually) doesn't the same question
arise?</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
