Tuesday, December 18, 2007

The Seam

One interesting thing I picked from the book "Working Effectively with Legacy Code" (Michael C. Feathers) is the concept about Code Seam. In a more everyday word, you can call it a flexibility point.

The seam is basically this : if you have part of the code that you would want to made to be more manageable i.e: easily tested, traced, modified, you start by making that part interchangeable. In class it could mean introducing interface, in function you could extract a wrapper function. After you have the flexibility in place, you could make alternate function for testing, make object or function mock.

The book has lots of details on how to do this, but the basic theme pretty much about The Seam. It seems I have been using some of the techniques in it (although without using the fancy name :) ), some are still new to me, some other kind of bend the language little although still understandable.

It's nice to finally have one term to name this kind of thing.

No comments: