<br><br><div class="gmail_quote">On Sun, Oct 2, 2011 at 8:51 PM, Rodney Polkinghorne <span dir="ltr"><<a href="mailto:rpolkinghorne@groupwise.swin.edu.au">rpolkinghorne@groupwise.swin.edu.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">>> Is this considered a bug, or a learning experience for new players?<br>
<br>
</div>By "this", I meant the consequence of my error (expected "Error: Foo<br>
needs a method for size", got a hung image), and the effort required<br>
to find its cause. I agree with Eliot's suggestion, that<br>
SequenceableCollection>>size should raise an error.<br>
<div class="im"><br>
> You should not instantiate an abstract class.<br>
<br>
</div>To follow that advice, I'd need a way to find out which classes were<br>
abstract, and when I'd implemented enough methods to stop them being<br>
abstract. That seems to be a black art in Smalltalk.<br>
<br>
There are two ways I could have written this. One is to define a<br>
subclass of Collection, and use the built-in collect:, inject:into:<br>
and so on. The other is to subclass Object, and define the iterators<br>
that I was going to use. Which approach is more common?<br></blockquote><div><br></div><div>The former is the one that makes sense. Why reinvent the wheel? The Collection hierarchy is designed to be both used and reused (subclassed). Copy-paste merely wastes space, makes the system more complex, and harder to maintain.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<font color="#888888"><br>
Rodney<br>
<br>
</font></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>