Skip to main content
added 399 characters in body
Source Link
Robert Bräutigam
  • 12.4k
  • 1
  • 20
  • 39

In reverse order: There is of course no generic answer as to which paradigm is "best" for microservices. You have to know your use-case and have to decide for your self. This is almost impossible to get right without a lot of experience, and even with it most projects get it wrong.

OOP vs. Functional: The two are not that different actually. Both have a concept of encapsulation, clear separation, etc. The key difference is that Functional tends to be more disciplined. You have to know your math and how problems can be decomposed mathematically. OOP is basically programming for math-challenged people. I'm saying that as an OOP developer. In any case, neither is more appropriate, it depends more on the people than the problem itself.

Communication between Microservices: The first rule of communication between microservices is that you shouldn't communicate between microservices. A microservice should be a functionally complete part of your domain. Any communication to other systems should be fire-and-forget type. That is, you either send a message to a system, or that system sends a message to you, but not both. Both would mean that your problem is not cleanly separated from the other service.

Anyway, the exact method of communication is not that important actually. Can be HTTP, through a Message Broker, or through TCP/IP connections. Does not matter, and should actually depend on the requirements of the communication itself. Should it support large amount of data, should it be secure, etc.

Summary: The most important thing is to get a clean decomposition of functionality (so you don't require request-response communication). All the other things you can experiment with easily then.

Also, it helps if you know why you are doing microservices. Presumably you have some non-functional requirements, like teams, operational requirements, performance/scaling requirements etc.

Ultimately whether you are doing it right depends on whether you can meet your goals regarding the architecture. There is no real absolute measurement of what is the "right way" except your own goals.

In reverse order: There is of course no generic answer as to which paradigm is "best" for microservices. You have to know your use-case and have to decide for your self. This is almost impossible to get right without a lot of experience, and even with it most projects get it wrong.

OOP vs. Functional: The two are not that different actually. Both have a concept of encapsulation, clear separation, etc. The key difference is that Functional tends to be more disciplined. You have to know your math and how problems can be decomposed mathematically. OOP is basically programming for math-challenged people. I'm saying that as an OOP developer. In any case, neither is more appropriate, it depends more on the people than the problem itself.

Communication between Microservices: The first rule of communication between microservices is that you shouldn't communicate between microservices. A microservice should be a functionally complete part of your domain. Any communication to other systems should be fire-and-forget type. That is, you either send a message to a system, or that system sends a message to you, but not both. Both would mean that your problem is not cleanly separated from the other service.

Anyway, the exact method of communication is not that important actually. Can be HTTP, through a Message Broker, or through TCP/IP connections. Does not matter, and should actually depend on the requirements of the communication itself. Should it support large amount of data, should it be secure, etc.

Summary: The most important thing is to get a clean decomposition of functionality (so you don't require request-response communication). All the other things you can experiment with easily then.

In reverse order: There is of course no generic answer as to which paradigm is "best" for microservices. You have to know your use-case and have to decide for your self. This is almost impossible to get right without a lot of experience, and even with it most projects get it wrong.

OOP vs. Functional: The two are not that different actually. Both have a concept of encapsulation, clear separation, etc. The key difference is that Functional tends to be more disciplined. You have to know your math and how problems can be decomposed mathematically. OOP is basically programming for math-challenged people. I'm saying that as an OOP developer. In any case, neither is more appropriate, it depends more on the people than the problem itself.

Communication between Microservices: The first rule of communication between microservices is that you shouldn't communicate between microservices. A microservice should be a functionally complete part of your domain. Any communication to other systems should be fire-and-forget type. That is, you either send a message to a system, or that system sends a message to you, but not both. Both would mean that your problem is not cleanly separated from the other service.

Anyway, the exact method of communication is not that important actually. Can be HTTP, through a Message Broker, or through TCP/IP connections. Does not matter, and should actually depend on the requirements of the communication itself. Should it support large amount of data, should it be secure, etc.

Summary: The most important thing is to get a clean decomposition of functionality (so you don't require request-response communication). All the other things you can experiment with easily then.

Also, it helps if you know why you are doing microservices. Presumably you have some non-functional requirements, like teams, operational requirements, performance/scaling requirements etc.

Ultimately whether you are doing it right depends on whether you can meet your goals regarding the architecture. There is no real absolute measurement of what is the "right way" except your own goals.

Source Link
Robert Bräutigam
  • 12.4k
  • 1
  • 20
  • 39

In reverse order: There is of course no generic answer as to which paradigm is "best" for microservices. You have to know your use-case and have to decide for your self. This is almost impossible to get right without a lot of experience, and even with it most projects get it wrong.

OOP vs. Functional: The two are not that different actually. Both have a concept of encapsulation, clear separation, etc. The key difference is that Functional tends to be more disciplined. You have to know your math and how problems can be decomposed mathematically. OOP is basically programming for math-challenged people. I'm saying that as an OOP developer. In any case, neither is more appropriate, it depends more on the people than the problem itself.

Communication between Microservices: The first rule of communication between microservices is that you shouldn't communicate between microservices. A microservice should be a functionally complete part of your domain. Any communication to other systems should be fire-and-forget type. That is, you either send a message to a system, or that system sends a message to you, but not both. Both would mean that your problem is not cleanly separated from the other service.

Anyway, the exact method of communication is not that important actually. Can be HTTP, through a Message Broker, or through TCP/IP connections. Does not matter, and should actually depend on the requirements of the communication itself. Should it support large amount of data, should it be secure, etc.

Summary: The most important thing is to get a clean decomposition of functionality (so you don't require request-response communication). All the other things you can experiment with easily then.