January 23rd, 2004, 09:02 PM
Currently I'm reading a book about refactoring code (The Refactoring Workbook). For those of you who don't know, this basically means auditing your existing code, or code you've inherited, and attempting to improve upon it.
The author has a website at http://www.refactoring.com which may be work a peek. He seems to focus on java code so far but says that C# or C++ programmers with enough reading knowledge of java can relate.
I was wondering if any of you have experience with this topic? What steps do you generally take and is there any software you use to help you with this process?
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
January 24th, 2004, 01:24 AM
This seems like it's a good read. Not familiar with the topic, but very interested (I program so I guess I should be!) I think I'll pick up a copy. Thanks for the heads up, Juridian.
January 24th, 2004, 11:50 AM
I'm currently contracting for a company who use XP (Extreme Programming) a lot.
We are developing Java-based web applications (using Java on the server side, NOT client side).
Refactoring is a major part of XP, being able to refactor safely.
As a development tool, we're using Eclipse. Its support for refactoring is extensive. In the Java perspective, click a class, choose "Refactor->Rename", you can rename a class in one simple operation.
The editor has built in refactoring too. It enables you to instantly pull expressions into local variables with a mouse-click etc.
Of course with all refactoring operations, this tool automatically searches for other methods / classes which depend on the refactored object(s), and updates them accordingly to use the refactored versions.
This is a good time-saver. It makes you not worry too much about giving things the wrong name or structure, because it's so easy to change.
Additionally, it's worth mentioning, that you have to use a source-code management system which allows you to modify files without first locking them.
In any case, with XP, your pair should be working in sufficiently short cycles that everything is committed at the end of the day (or perhaps lunchtime) - all tests working.