    <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  :: Editor &lt;&lt; letters;</title>
        <link>https://members.accu.org/index.php/journals/582</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">Overload Journal #28 - Oct 1998 + Programming Topics + Letters to the Editor</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/c78/">Overload</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c175/">28</a>
                    (10)
<br />

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

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

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c65/">Programming</a>
                    (877)
<br />

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

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

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

                                            <a href="https://members.accu.org/index.php/journals/c175-65-186/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c175+65+186/">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;Editor &lt;&lt; letters;</h1>
<p><strong>Author:</strong>&nbsp;</p>
<p>
<strong>Date:</strong> 27 October 1999 18:23:02 +01:00 or Wed, 27 October 1999 18:23:02 +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="d0e11" id="d0e11"></a>Exploring
Patterns Comments from Aaron Ridout <tt class="email">&lt;<a href=
"mailto:aaron@blackcat.co.uk">aaron@blackcat.co.uk</a>&gt;</tt></h2>
</div>
<p>It is not often that I find myself with stronger feelings than
Francis, but after his excellent article in Overload 27 on
'Exploring Patterns', I feel I must write. Not that I disagree with
anything Francis said, but having worked on one large-ish project
(20+ developers for 15+ months) the project turned more into source
code maintenance, for which the following observations became more
and more apparent.</p>
<p>For any non-value based class, I would strongly recommend that
all attributes of any class should be private, and accessor
functions to Get and Set should be provided but scoped as small as
possible, (I.e. Private rather than Protected rather than
Public).</p>
<p>Now that we have said that all attributes will have accessor
functions, the only place that the attributes must be referenced
directly (if at all) is in any constructors and destructors. No
other class function should access any attribute directly. The
reason for these apparently draconian limitations, is that you can
now change the attributes without changing the entire class. I view
this as a halfway house to implementing a real Cheshire cat, i.e. a
Cheshire cat with only private attributes.</p>
<p>For attributes that are values (and this possibly includes
references) you typically end up with the following. I've rolled
the code into the class declaration for simplicity of the example,
never do this in real life, keep them separate until you can prove
that performance is an issue and the inline does save run-time)</p>
<pre class="programlisting">
class Obj
{
private:
  T attrib ;
private:
  // Protected or Public IF required
  T const GetAttrib() const 
  { return attrib ; } ;
  void SetAttrib( T newvalue ) 
  { attrib = newvalue ; } ;
} ;
</pre>
<p>If an attribute is a pointer then I think you are going to end
up with four accessor functions:</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>Get/Set the pointer</p>
</li>
<li>
<p>Get/Set the de-referenced pointer (or the object)</p>
</li>
</ol>
</div>
<p>Furthermore, there are const issues to consider. At this time I
have not found the 'one' solution to this problem:</p>
<pre class="programlisting">
class Obj
{
private:
  // I'd rather this were 'T *const'
  T *p_attrib ; 
  // probably private,
  // should not need to be more open
private:
  T const *const GetAttribPtr() const 
  { return p_attrib ; } ;
  void SetAttribPtr( T *newptr ) 
  { p_attrib = newptr ; } ;
  // Protected or Public IF required
private:
  T const GetAttrib() const 
  { return *p_attrib ; } ;
  void SetAttrib( T newvalue ) 
  { *p_attrib = newvalue ; } ;
};
</pre>
<p>Another problem I found, on the same project, was that once
pointers to objects are used, do not allow some domains to start
using references to the same type of objects. This is to reinforce
the idea of 'don't mix references and pointers'. I see this as part
of what Kevlin was saying at the excellent ACCU Forum, that we must
manage our object life times. I think we should include the concept
of whether we 'talk' to our object via pointers, references or
directly (by-value) as this is another aspect of their exterior
design that most software designers do not consider fully.</p>
</div>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
