Changes in Microservices
Within a microservice adjustments are easy. The microservices are small and manageable. It is no big deal to adjust structures. If the architecture of an individual microservice is completely insufficient, it can be rewritten since it is not very large. Within a microservice it is also easy to move components or to restructure the code in other ways. The term “refactoring” describes techniques that serve to improve the structure of code. Many of these techniques can be automated using development tools. This enables an easy adjustment of the code of an individual microservice.
Changes to the Overall Architecture
However, when the division of functionality between the microservices is no longer in line with the requirements, changing just one microservice will not be sufficient. To achieve the necessary adjustment of the complete architecture, functionality has to be moved between microservices. There can be different reasons for this:
- • The microservice is too large and has to be divided. Indications for this can be that the microservice is no longer intelligible anymore or so large that a single team is not sufficient to develop it further. Another indication can be that the microservice contains more than one Bounded Context.
- • A piece of functionality really belongs in another microservice. An indication for that can be that certain parts of a microservice communicate a lot with another microservice. In this situation the microservices no longer have a loose coupling. Such intense communication can imply that the component belongs in another microservice. Likewise, a low cohesion in a microservice can suggest that the microservice should be divided. In that case there are areas in a microservice that depend little on each other. Consequently, they do not really have to be in one microservice.
• A piece of functionality should be used by multiple microservices. For instance, this can become necessary when a microservice has to use logic from another microservice because of some new piece of functionality.
There are three main challenges: microservices have to be split, code has to be moved from one microservice into another, and multiple microservices are supposed to use the same code.
-  Martin Fowler. 1999. Refactoring: Improving the Design of Existing Code, Boston: Addison-Wesley.