Refactoring of the Year?

Göran Krampe goran at krampe.se
Wed Feb 21 10:21:22 UTC 2007


Hi Andreas and all!

> Hi Guys -
>
> I'm just in a writing mood today so I thought I'd share a short story.

:)

> Most of you are probably aware how I have been bitching and moaning
> about "random refactorings" that move things from one corner of the
> system to the other, rename them incompatibly in the meantime and just
> generally leave more cruft and problems than they solve?
>
> Well, I just had a completely opposite experience that shows Refactoring
> Done Right. The short version is: We had some serious problems at Qwaq
> with SocketStream in Croquet (which is a 3.8 variant) that has a variety
> of problems in it (our main problem was the lock-up you get in next: if
> a particular sequence of steps occurs). I was finally able to track this
> down to SocketStream and was ready to start a discussion on Squeak-dev
> when I -just to confirm it- tried it in 3.9 and noticed that it worked
> just fine there and that 3.9 has the FastSocketStream version instead of
> the 3.8 version.

Yes, I think Marcus threw it into 3.9.

> So ... okay I thought this is going to break a number of things since
> really, it's a complete reimplementation so what can you expect. But I
> was willing to debug it and fix the remaining problems because
> SocketStream had proven to be simply to unreliable. Filed in
> SocketStream, immediately ran into two problems (missing methods in
> Socket that it required) added those.
>
> And that was it. I didn't change another line of code other than these
> (basically internal) changes. It just worked. It has the same interface,
> it works the same. Only better. Faster. More reliable.

And it has a long terribly detailed class comment too. :)

Btw, there is one thing in this code that I really would like to fix, see
#upTo: and #upToAll: (same code basically). In short - I would like a new
primitive or have the existing primitive (primitiveIndexOfAsciiInString)
take an extra stoppingAt: argument.

The current workarounds in those two methods are... hideous. :)

regards, <blushing> Göran

PS. One thing that we/I SHOULD add is more unit tests though.





More information about the Squeak-dev mailing list