Refactoring of the Year?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Refactoring of the Year?

Andreas.Raab
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.

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.

Suffice it to say, I was impressed. I had gotten so used to the
assumption that a new version of a class (as well as Squeak) is so
fundamentally incompatible with previous versions that I stopped porting
stuff when we reached 3.9. SocketStream was the nicest exception to that
pattern that I've seen in the last two years or so.

Can I officially request that we award Goran a medal for the
"Refactoring of the Year"? Something that basically nobody noticed but
that has a profound impact on network performance and reliability
certainly qualifies for that.

Cheers,
    - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: Refactoring of the Year?

Göran Krampe
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.



Reply | Threaded
Open this post in threaded view
|

RE: Refactoring of the Year?

Ron Teitelbaum
In reply to this post by Andreas.Raab
+1 Thanks for sharing that!  He's got my vote.  I'm using his code
extensively but I started with 3.9 so I didn't even know it was broken.  

You have said a number of times that we do not do enough to recognize
contributions.  Maybe we should consider having Squeak Awards?

Ron Teitelbaum

> -----Original Message-----
> From: [hidden email] [mailto:squeak-dev-
> [hidden email]] On Behalf Of Andreas Raab
> Sent: Wednesday, February 21, 2007 5:00 AM
> To: The general-purpose Squeak developers list
> Subject: Refactoring of the Year?
>
> 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.
>
> 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.
>
> Suffice it to say, I was impressed. I had gotten so used to the
> assumption that a new version of a class (as well as Squeak) is so
> fundamentally incompatible with previous versions that I stopped porting
> stuff when we reached 3.9. SocketStream was the nicest exception to that
> pattern that I've seen in the last two years or so.
>
> Can I officially request that we award Goran a medal for the
> "Refactoring of the Year"? Something that basically nobody noticed but
> that has a profound impact on network performance and reliability
> certainly qualifies for that.
>
> Cheers,
>     - Andreas



Reply | Threaded
Open this post in threaded view
|

Re: Refactoring of the Year?

stephane ducasse
In reply to this post by Andreas.Raab
:)

You can!

with experience now, I would really suggest the following patterns:
Make the new and old coexist, slowly migrate from the old to the new.
With that we could have tested and appreciated Flow, for example. Of  
course if the interface are the same this is
really better.

Stef

On 21 févr. 07, at 10:59, Andreas Raab wrote:

> 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.
>
> 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.
>
> Suffice it to say, I was impressed. I had gotten so used to the  
> assumption that a new version of a class (as well as Squeak) is so  
> fundamentally incompatible with previous versions that I stopped  
> porting stuff when we reached 3.9. SocketStream was the nicest  
> exception to that pattern that I've seen in the last two years or so.
>
> Can I officially request that we award Goran a medal for the  
> "Refactoring of the Year"? Something that basically nobody noticed  
> but that has a profound impact on network performance and  
> reliability certainly qualifies for that.
>
> Cheers,
>    - Andreas
>
>


Reply | Threaded
Open this post in threaded view
|

RE: Refactoring of the Year?

J J-6
In reply to this post by Andreas.Raab
+1

>From: Andreas Raab <[hidden email]>
>Reply-To: The general-purpose Squeak developers
>list<[hidden email]>
>To: The general-purpose Squeak developers
>list<[hidden email]>
>Subject: Refactoring of the Year?
>Date: Wed, 21 Feb 2007 01:59:38 -0800
>
>Can I officially request that we award Goran a medal for the "Refactoring
>of the Year"? Something that basically nobody noticed but that has a
>profound impact on network performance and reliability certainly qualifies
>for that.

_________________________________________________________________
Refi Now: Rates near 39yr lows!  $430,000 Mortgage for $1,399/mo - Calculate
new payment
http://www.lowermybills.com/lre/index.jsp?sourceid=lmb-9632-17727&moid=7581