Wolf

Software Development

Code refactoring

/
/
/

Major repairs or redesigning at least once in your life, probably everyone did. Pipes and wiring wear out, finishes and furnishings become obsolete, the arrangement of rooms ceases to be convenient. Refactoring is comparable to complete overhaul and implies redesigning and correcting the code. The inner structure of the program changes, while its behavior remains the same.

Code refactoring is often needed because

  • The first version was made hastily or “as cheaply as possible.”
  • a new version of compiler or libraries appeared;
  • previous programmers may have made architectural mistakes;
  • as you use it, it becomes clear that new features are needed.

Low-quality code is cumbersome and unreadable, storing passwords in cookies, complex URLs, naming variables in different languages.

Refactoring fixes

01 heterogeneous style triangle circle square heterogeneous style naming variables, methods, classes.
02 duplicate code two scripts Duplicate code.
03 long class Long methods and classes.
04 overloaded list Overloaded list of parameters of functions and methods.
05 long blocks scheme Long branching blocks.
06 magic sign Magic values.
07 obscure abbreviation Use of obscure abbreviations.
08 Rigid assumption Rigid coding of assumptions.
09 excessive configuring Excessive configuring.
10 confusing code Confusing code.
11 abstraction levels circle heptagon triangle Excessive number of abstraction levels.
12 dependent class Excessive interdependence of classes on each other.
13 no check crossed out list No check of input data.
14 Overloaded class Overloading classes and components with heterogeneous functionality.
15 generalized code Overgeneralization of code.
16 Variables in fields Storing temporary values in fields.
17 Mediator classes Mediator classes.
18 No class isolation Lack of class isolation.
19 Irrelevant inheritance Irrelevant inheritance of classes.
20 Inheritance Delegation Inheritance instead of delegation.
21 logic outside of classes Logic outside of subject area classes.
22 direct calls Direct calls between far-flung parts of the system.
23 Unused code Unused code.
24 cpu consumption Consumption of the CPU to wait.
25 No parallel cpu Incorrect paralleling of tasks or not using threads.
26 Separate branch Separate code for special cases.
27 Library Self-written code instead of using a library.
28 little commenting Insufficient commenting of code or excessive commenting of obvious sections.

Failure to refactor leads to the fact that any small code interference will cause a succession of errors and corrections. The second unpleasant consequence can be recurring occasional critical errors, which will be very difficult to reproduce, diagnose and debug. Finally, the gradual addition of new features will lead to a buildup of functionality, which in turn will have a negative impact on the program and will cause dissatisfaction among users.

  • Facebook
  • Twitter
  • Linkedin
  • Pinterest

This div height required for enabling the sticky sidebar