Comments on: Refactor then Change Legacy Code https://simpleprogrammer.com/refactor-then-change-legacy-code/ Fri, 23 Feb 2018 15:21:08 +0000 hourly 1 https://wordpress.org/?v=7.0 By: Uri https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-132 Mon, 17 Oct 2011 16:02:51 +0000 https://simpleprogrammer.com/?p=560#comment-132 In reply to jsonmez.

I appreciate the effort 🙂

]]>
By: jsonmez https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-131 Mon, 17 Oct 2011 14:31:44 +0000 https://simpleprogrammer.com/?p=560#comment-131 In reply to Uri.

Sorry, I do not.

]]>
By: Uri https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-130 Mon, 17 Oct 2011 05:59:42 +0000 https://simpleprogrammer.com/?p=560#comment-130 Hi John,

I want an automatic tool that could convert a nested code such kind of:

(C / C++)

if (q1 && q2 || ….)
{
do_1();
if (q3 …)
{
do_3();
if (q4 …)
{
do_4();

}
else
{
do_e4();

}
else
{
do_e3();

}
}

To the type of linear code:

if (q1 && q2 || ….)
do_1();

if ((q1 && q2 || ….) && q3)
do_3();

if ((q1 && q2 || ….) && q3 && q4)
do_4();

if ((q1 && q2 || ….) && q3 && !q4)
do_e4();

if ((q1 && q2 || ….) && !q3)
do_e3();

Do you know of such a tool?

Thank you

Uri.

]]>
By: jsonmez https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-129 Sun, 22 Aug 2010 07:41:28 +0000 https://simpleprogrammer.com/?p=560#comment-129 In reply to David Sackstein.

Actually, in general I agree with you, but if you can use IDE refactoring tools to do the refactoring, you can be sure to not change functionality.
Of course if you can write tests that verify how the system currently functions before making any change, that is the best option. It is not always an option though.

]]>
By: David Sackstein https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-128 Sun, 22 Aug 2010 05:30:06 +0000 https://simpleprogrammer.com/?p=560#comment-128 Hi John,
I like the Agile approach, but I fear that your “better approach” is more risky than you can afford.
You should not attempt refactoring legacy code without having tests that assert the correctness of the system.
This can be difficult for a legacy system for which noone can define exactly what it does and I am looking for articles and suggestions on how to do that.
But my inituition tells me that this is definitely a required first step.
Refactoring without tests, especially on a system you dont understand, is a sure recipe to introduce errors at the start.
Do you agree?
I’d be happy to hear your opinion.
David

]]>
By: eswarann https://simpleprogrammer.com/refactor-then-change-legacy-code/#comment-127 Wed, 26 May 2010 18:49:02 +0000 https://simpleprogrammer.com/?p=560#comment-127 I agree. In fact I would hazard that the legacy footprint is probably 10-20% oversized than that is in use.

Migration exercises often is best done by anlaysing the legacy code inventory to spot unused uncalled modules and reducing the footprint leaving behind a more relevant codeset.

see:http://eswarann.wordpress.com/2010/04/23/on-understanding-code/

]]>