17 ms·
Microservices Pros: Code reusability? Please ELI5 how I get better code reuseability in microservices than in my monolith with separated concerns into librarie
by glutamate 5y ago
Microservices Pros: Code reusability?
Please ELI5 how I get better code reuseability in microservices than in my monolith with separated concerns into libraries and helper modules.
- shikoba 5y agoI think the idea is that if you only need for an external tool one service you don't need the whole thing.
- auspex 5y agoIf you have an “authentication” micro service. I can just reuse/deploy the service for my new app. No coding (maybe some configuration)
- scottious 5y agoI find a lot of people create micro-services when a simple library would suffice. An "authentication" micro-service might make sense in some contexts, but in almost every real-world situation I've been in, this would be better as a library.
- chomp 5y agoYeah I think it's better rephrased as "service reusability". A proper microservice should be able to be redeployed anywhere for anything. If you have an authenticate() function in an auth helper library, you can move that around to new web apps to help users authenticate with different parts of your site(s). Your authenticate() function for a microservice is probably going to be part of a broader "microservice api library" that gets reused, but I can't imagine reusing the microservice code itself - you're supposed to just spin up a new one.