Search code examples
microservices

Is microservices reusability important?


Is reusability in microservices important?

Is it important to design a microservice based solution reusing a lot of them in mind?

My first impression is NO because other things like subdivision of responsibilities is more important than reusability but I'm not sure because I'm a newbie in the fantastic microservices world. I'm just studying microservices theory at this moment.


Solution

  • A microservice should be part of a bigger solution to solve something.

    Let me give you a simple example: a restaurant.

    I can think in some microservices that will compose a solution for a restaurant: Order Microservice, Kitchen Microservice and so on.

    If the “reuse” that you are saying is regarding other microservices “using” (calling) each other, them yes. But if you are talking about sharing model (for example, Java beans), then NO!

    Microservices should never reuse model of other Microservices. Each one must have its own set of models. Why? Because changing one won’t affect other Microservices.

    Teams should work independently (one team per Microservice).