Home    C# Refactory    Metrics    Order    Download    Updates

Refactoring and Extreme Programming - Code re-use

We all know the scenario. You have inherited or created a large 'mass' of software which has gradually become more and more complex, to the point where no single person has a real handle on the whole. You are faced with the dilemma of beginning anew or accepting longer and longer times for changes to be made, along with a reduction in reliability.

Since computing science crawled out of the laboratories, people have been talking about code-reuse. Various methodologies have been invented and put forth as the solutions to our coding and management problems. Structured programming and object technologies have been the main changes which have markedly improved our chances of handling the every-increasing complexity of the code we are asked to work with.

True code-reuse has escaped us, though. Even with well designed class heirarchies, purpose built code tends to be too specific to be extracted and used for more than one project. To make it so requires an inordinate amount of up-front planning, which is best left to organizations without specific project aims. In fact, the one area of successful code re-use has been the creation of a "component" industry. Beginning in force with Visual Basic, and nurtured to maturity by Delphi and to a lesser extent COM and ActiveX, these "palettized" components have become a cornerstone of modern RAD development. Visual Studio.NET has taken these components to a new level, with more mature models to allow even easier packaging of code into reusable components.

But supposing you already have some code, which is specific to an old project, which does 90% of a task you need to do again in your current project, or even again in the same project. How do you go about extracting and generalizing the relevant bits without creating a maintainence nightmare. After all, you only partially understand the code in question. If you extract it by hand, you risk missing or destroying crucial code. This dilemma has lead, in the past, to the ever-popular practice of "copy and re-use", where the code is copies wholesale, and then patched to work in the new instance. The problems with this are self-evident. Instead of one partially understood unit of code, you now have two, which will each mature separately and slowly diverge, leaving you with a costly maintainence legacy.

The solution to this is refactoring...


Xtreme Simplicity use csUnit - a unit testing framework for C# -

This site and its contents are © copyright Xtreme Simplicity, 2008. All rights reserved. Updateable website by Websites at Work, developers of Take A Break Australian Holiday Accommodation. Design by Graphics That Work.


Code re-use
What is refactoring?
Why refactor?
Refactorings
Links

"I was working on a project that would have taken at least a week to refactor. Using the trial version it took me one day." - Derrick Spead MCSD

"Very slick little piece." - Michael Stuart (MS), Dot Net Rocks

"It’s clean, simple and fast." - Larry O'Brien, SD Times

"I am extremely pleased with C# Refactory. Nice work!" - Mark Griffiths, Chive Software Limited

"Thanks again for a great product. I just downloaded version 1.12 only two days ago and the new find references command along with the rename functionality has already saved me hours of work." - Mike Two, Thoughtworks

"So far it has helped me in my tasks and I have only owned it for less than a day." - Rich Denis

"C# Refactory is more than a simple refactoring tool. The detailed metrics are a great help for locating complicated or lengthy code that needs to be refactored. What's more, the product team quickly answers support requests and welcomes suggestions. I am already looking forward to the upcoming versions, knowing that features, quality and performance are equally important to Xtreme Simplicity." -- Bernard Vander Beken

"The program does a great job. At last I have some of the refactoring functions I like so much in the java development environment (we use IntelliJ Idea) in Visual Studio. That's great because once you get used to these functions you never ever want to miss them ...
I also appreciate the speed in which you deliver new builds of the software. Everytime I wanted to write an email in which I describe a missbehaviour you were faster and the new build solved this problem.
Keep on that good work!"
- Markus Renschler, csUnit developer

"Xtreme Simplicity have created a tool which drastically simplifies refactoring the architecture of any C# application through seamless integration with Visual Studio. CSharp Refactory statically analyzes our product to guarantee compilation success following a refactoring. In addition, Xtreme Simplicity thoughtfully provided a fully-featured metrics tool so we can watch our lines of code decrease as our architecture improves!" - Richard Birkby - Chief Architect, Thundermain Ltd.