Recently, I started reading of Building Microservices by Sam Newman. So far it's a great book. I'll wait for the final evaluation until the end of the book, but I can tell I'm already learning a lot.

Today I learned that we can distinguish two basic styles of the software architecture:

  • orchestrated
  • choreographed

The orchestrated style is somewhat similar to the director of an orchestra. He has all members of the orchestra to his disposals, and he tells everyone how to play in order to get all the things done. For those who actually know how the orchestra works — I really apologize for this analogy :), I have no idea about that. In this style, there is main unit / module (just piece of code). This unit has all services required to do all work, and it tells those services what to do. Pretty simple, and it's probably the most common style.

The choreographed style is more about, well — choreography. This time, everyone knows what to do when the time comes and if everyone does its job at the right time, then everything will be fine. In this scenario each service knows that it should do its job when it's the right time and if it does that and every other service does its job at the right time, then everything will be right. This style is basically event based approach. When event is fired, appropriate service catches it and does its job.

Both styles have its advantages and disadvantages. The orchestrated style is easier to implement and reason about. The disadvantage here is that it's a lot easier to make coupling between services, and it's harder to keep high cohesion.

The choreographed style involves event-based approach which is generally harder to reason about, especially without an experience. On the other hand it's easier to keep services and its details closed to outside world and thus making it easier to keep high cohesion.