The Source for Java Technology Collaboration
User: Password:



William C. Wake

William C. Wake's Blog

Scratch Refactoring

Posted by wwake on May 12, 2004 at 03:54 AM | Comments (5)

I recently had a chance to do some refactoring of some Visual Basic code. I hadn't worked with it in several years. In particular, I hadn't worked with the object support that's in VB.Net. It's very striking how much it's like C# with different keywords.

My task was to convert some code from using web services (which were too slow) to just straight object code. Several factors came together:

  • My unfamiliarity with VB.Net and web services.
  • The fact that I was heading out of town for a week and didn't want to risk leaving problems.
  • The team's use of source control which locks checked-out files. (I'm lobbying to change this.)
  • A desire for extra care as the product has almost no automated tests.

This led me to do a scratch refactoring: refactoring with the intent of throwing it away and re-doing it. I refactored away two sets of web services, writing down each of the changes I intended to make (along with the name of the affected file.)

I found several benefits:

  • I learned some little tricks for how to get the compiler to tell me what needed doing.
  • Knowing I would throw the result away let the scratch refactoring go more quickly.
  • I learned a couple tricks for the IDE.
  • When I came back after my trip (to do the real thing), I felt like I was just flying through the changes.

I think it was Brooks who said something like, "It's faster to make a 6-inch mirror and a 10-inch mirror than it is to make a 10-inch mirror." I found that true in this case.


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Brooks also said...
    plan to throw one away - you will anyway.

    However, I too use /scratch refactoring/ but didn't have a nifty phrase for it - I called it "Let-me-get-it-working-now-so-I-can-do-it-correctly-later" refactoring. :-P

    -Mel

    Posted by: melriffe on May 12, 2004 at 05:33 AM

  • Hello Isnt this a java.net site
    It is sad to see examples of C# and VB on Java.Net sites. You should really blog these on blogs.msdn.com or some other blog.

    Beats me how many people are using java.net to tell general stories.

    Posted by: vibhu_s on May 12, 2004 at 08:33 AM

  • Hello Isnt this a java.net site

    After being in the Java community exclusively and then switching into .Net for a new job, I've noticed a huge difference in the two communitites...


    In the Java community, there is collaboration all over the place. There are hundreds of developers working on shared libraries to do everything under the sun (no pun intended). Some are wonderful (jdom, for example) and some are complete crap, but they're all collaborative.

    In the .Net community, there is almost none of this. It seems like almost every collaborative project out there is funded/supported by Microsoft. I've even found "Open Source .Net" sites that aren't "Open Source" at all.... they just sell other people's libraries and have forums for "support".

    I think that no matter how much money MS has, if they don't start building up their community of developers and libraries, .Net is not going to fly.... except in those places where the developers insist on writing everything themselves.

    My 0.02

    KC

    Posted by: caseydk on May 13, 2004 at 04:51 AM

  • Hmmm... Isn't that prototyping by another name?
    I agree that this is often a very effective way of working, I often knock together some code in order to feel out the shape of an effective solution. But I tend to call it a 'Prototype'.

    Mind you 'Scratch Refactoring' will probably be a good way of selling it when a prototype that was forced to production by management or marketing finally collapses beneath it's own cruft and needs a rewrite.

    Posted by: bob_boothby on May 20, 2004 at 01:19 AM

  • Hello Isnt this a java.net site
    The large number of .net projects on sourceforge and elsewhere suggest that collaboration is alive and well in the .net community.

    Posted by: alandean on August 27, 2004 at 03:54 PM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds