I have recently come across the terms migration pattern and refactoring on the topic of migrating monoliths to microservices. Is there any real difference between the two terms, or can they be used interchangeably?


Typically they are not the same thing.

Refactoring: "the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure" -- (from Martin Fowler)

Migration is the process of moving data and/or logic to a completely new implementation.

The intent behind refactoring is a series of small, targeted changes that can be easily reversed. At least that's how it was originally sold. The concept is that it is much smaller in scope than a whole-sale rewrite, so it is also much less risky.

In the context of your question, your definition of "refactor" is essentially a rewrite that provides the same features as the monolithic application. It's better understood in these terms:

  • Refactor is the "what"
  • Migration is the "how"

As you are refactoring portions of your monolithic application, you would migrate the code in the monolithic app that used to perform the function to call the microservice you created to replace that code. If necessary, the data that was managed by the monolithic application is migrated to the data store used by the microservice(s).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.