14.07.2024 | refactor

Recently ive found good book about programming heuristics. It is a set of short articles giving some advice about how to approach problems connected with design and maintenance of software. The title is "97 things every programmer should known". Each chapter is written by experienced developers willing to share their observations with others. The articles are not specific but gives an overview of the problem and highlights things to pay special attention to.
One of the chapters says about refactoring. Firstly it is good to take a step back, define a scope of work to be done and analyse its contents as it is. It is easy to juggle the ideas how great solutions we may introduce instead of existing messy, imperfect code. We all know we are good programmers capable of good design and bold ideas. But in this case i recommend stop thinking about what could be and try to emphatise whith the people who were involved in the process of development of code that we intent to refactor. Lets find answers to several questions: what is a purpose of this code ?
what are the dependencies introduced into the code?
what is outcome of the code ?
what are critical areas of the solution?
why the solution is insufficient?
How we will ensure to improve faulty code ?
what we want to obtain by a refactor?
what will be cost of refactor?
In such way we are able to establish a solid ground for further actions. The next rule worth remembering is to divide work into small independent tasks or groups of tasks posible to finish. Otherwise it is likely to end up with same complex and messy code but with additional hours of work. Even though existing code is messy it has several advantages: It works
It already was refined by a team in a development, refactoring and testing process
Most probably it was tested at least manualy
The best approach is not to work against code under refactor but use it to your own adwantage Cheers gmarcin

Komentarze

Popularne posty z tego bloga

[WP] 23.06.2023 | subjects

15.07.2024 | simplicity

[WP] 05.06.2023 | angular-intro