How do you refactor a bad code?

Member

sidney

by sidney , in category: Technology , 16 days ago

How do you refactor a bad code?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by melvina , 16 days ago

You will have to start Ratcheting.


This is because Ratcheting identifies the general pain point in your application.


It will quantify it so that it can be measured. In the end, you will write a test against it.


The idea is that your ratchet will tighten over time, and this will reduce the underlying problem gradually. This can start to loosen if someone makes a change ( reverse).


Martin Fowler the Author of Refactoring: Improving the Design of Existing Code explains how these practices have helped developers. Also. with Refactoring you will need the safety harness of a unit test suite to remove the "Have I broken it?" feeling. The bad code will have to be coved by taking tests that will help you while you strive for a good clean code.


Micheal Feathers the Author of Working Effectively with Legacy Code will help further explain how it will have to be tested. You can find some examples of bad code on this website https://crapcodes.com