Modularization of legacy code
Zbigniew Romanowski
Analyst, optimization algorithms, operations research, AMPL, linear programming
Modular programming: What is it?
Modular programming, as defined by Wikipedia, is a method of computer programming that divides an IT system into separate, swappable modules, each of which has all the components required to carry out a particular function.
What is contained in the module?
What does legacy code mean?
A legacy code is a dated program with the following characteristics:
How may the code be made to be of higher quality?
When adding new functionality to the system quickly, affordably, and without breaking existing functionality, we say that the code quality is good. By breaking the system down into modules, or by implementing code modularization, one (and possibly the only) way to improve the quality of legacy code can be accomplished.
The outcome of modularization is what?
Why is modularization advantageous?
The code after modularization is substantially simpler to maintain since the process divides the code into smaller, often independent components that are easier to review.
Modularization makes it easier to develop the code and add new features, mostly because it divides the code into libraries.
It is easier to re-code the feature after modularization since the process of dividing the code into libraries provides relevant information about the dependencies in the code, which is very helpful when making decisions about future alterations in the code.
Modularization lowers the cost of onboarding a new employee. Because it takes less time for a new employee to become comfortable with the system, costs have decreased.
领英推荐
Modularization separates the system into sections, allowing the system to be sold separately.
A modular system allows you to dive the group of programmers who maintain the entire system into teams working on particular library. The division of the group into teams allows them to gain the deeper understanding of the maintained part of the system.
Using modularisation, it is possible to focus on tests within a library, which facilitates test maintenance and lowers development's costs.
As a result of modularization, unnecessary dependencies between files are removed, which are usually caused by excessive inclusion of files using the #include preprocessor directive. Removing these unnecessary dependencies leads to reducing the compilation time and building the system.
What are the assumptions of modularization?
The basic assumption of modularization is that the system after modularization and before modularization has identical functionality, and interfaces in classes were not changed or they were changed only slightly. It is only after modularization that steps are taken to change the code or re-factor the code. The division of the modernization (reconstruction) of the code into two stages (where the first stage is modularization) allows us to avoid introducing errors to a greater extent.
It is preferable that the modularized code be integrated with the continuous integration system, which is used to build code and run tests.
Modularization does not block the simultaneous development of the system.
The modularization process is significantly impeded when global variables or singletons are used in the implementation, which introduce strict global dependencies between classes.
How is modularization carried out?
Modularization is carried out on the existing system, which means that the alternative version of the system is not built.
The first stage of modularization is to define the most basic classes that will create a library (module). After creating the module, it is turned on and used in the system.
The next modularization steps involve selecting classes that only use modularized libraries and integrating them into the system. Thus, the system is transformed in a modularized systematic way.
References