I&#39;ve seen both. <br><br>I try to avoid creating accessors and only add them as I need. I try to create methods based on the responsibilities of the object and not around its data structure.<br><br>But, I&#39;ve worked on projects where every object had accessors for every variable (often necessitated by the persistence framework). You have to trust the programmers not to abuse them as a simple data structure.<br>
<br>Kent Beck&#39;s Smalltalk Best Practice Patterns describes the forces behind each approach.<br><br>Another reason to use accessors is lazy initialization.<br><br><div class="gmail_quote">On Tue, Jan 6, 2009 at 8:17 AM, Ryan Zerby <span dir="ltr">&lt;<a href="mailto:tahognome@gmail.com">tahognome@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I&#39;m going through the laser game example presented on this list a<br>
short time ago. &nbsp;I notice that he creates accessors for everything.<br>
Can someone explain the reasoning for that? &nbsp;I can understand having a<br>
wrapper for those functions for which you want external access.<br>
However, doesn&#39;t it effectively remove the protection of private<br>
variables by providing such open access on EVERYTHING.<br>
<br>
What&#39;s the Tao of Squeak on this subject?<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@lists.squeakfoundation.org">Beginners@lists.squeakfoundation.org</a><br>
<a href="http://lists.squeakfoundation.org/mailman/listinfo/beginners" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br>