Knowledge Center

What Is Database Refactoring?

For the first time, the term “refactoring” was introduced by Martin Fowler in 1999. This concept described the process of the code reengineering. Its idea was based on improving the code quality and simplifying its perception via small changes in the code.

Also, Martin introduced the “code smell” concept for determining code which should undergo refactoring.

What are code smell characteristics?

  • Long methods
  • Methods with a big number of parameters
  • Fragments duplicating
  • Switch operator

But refactoring does not mean adding some new functionality to the system. The specialists only improve the ready-made code, not add the new one. Refactoring may be performed before the new features implementation. It is of great importance to differ these two processes - refactoring and adding new functionality.

Also, testing is an inherent part of the refactoring process as any code changes may lead to severe errors. To prevent that, database functional testing, as well as integration testing, and performance testing are conducted.

How to effectively perform database refactoring?

  • First, it is necessary to define areas which may be involved in the future code modification. It is important to realize the full scope of interaction between the database and third-party applications.
  • One should not enter many changes at once. In the case of database operation failure, it will be easily to discover the error cause and remove it.
  • Database testing is a rather complex and time-consuming process. Therefore, it is better to launch tests after each modification in order to make sure that everything works in a proper way.
  • All changes should be ideally performed on the test platforms, not directly on the product. One should not forget about regression testing too.