When working with development teams transitioning from a monolithic applications to microservices I sometimes face their anxiety of breaking the 𝗗𝗥𝗬 (𝗱𝗼𝗻’𝘁 𝗿𝗲𝗽𝗲𝗮𝘁 𝘆𝗼𝘂𝗿𝘀𝗲𝗹𝗳) 𝗽𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲.
𝗪𝗵𝗲𝗻 𝘀𝗮𝗺𝗲 𝘁𝗲𝗮𝗺 𝗶𝘀 𝘄𝗼𝗿𝗸𝗶𝗻𝗴 𝗼𝗻 𝗺𝘂𝗹𝘁𝗶𝗽𝗹𝗲 𝗺𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲𝘀 𝘁𝗵𝗲𝘆 𝗮𝗿𝗲 𝗶𝗻𝗰𝗹𝗶𝗻𝗲𝗱 𝘁𝗼 𝗲𝘅𝘁𝗿𝗮𝗰𝘁 𝗰𝗼𝗺𝗺𝗼𝗻 𝗰𝗼𝗱𝗲 𝗮𝗻𝗱 𝗿𝗲𝘂𝘀𝗲 𝗶𝘁 𝗮𝗰𝗿𝗼𝘀𝘀 𝗺𝗶𝗰𝗿𝗼𝘀𝗲𝗿𝘃𝗶𝗰𝗲𝘀.
If you are inclined to do the same then think about the ideas bellow.
1. Having classed named the same in multiple microservices (for example Customer in both Checkout and OrderManagement microservices) is not a violation of the DRY principles. It is a consequence of 𝘴𝘦𝘱𝘢𝘳𝘢𝘵𝘪𝘰𝘯 𝘰𝘧 𝘤𝘰𝘯𝘤𝘦𝘳𝘯𝘴 between two different 𝘣𝘰𝘶𝘯𝘥𝘦𝘥 𝘤𝘰𝘯𝘵𝘦𝘹𝘵𝘴 .
2. Duplicating functionality in multiple microservices is usually a sign of bad design. A microservice should have only one responsibility – 𝘴𝘪𝘯𝘨𝘭𝘦 𝘳𝘦𝘴𝘱𝘰𝘯𝘴𝘪𝘣𝘪𝘭𝘪𝘵𝘺 𝘱𝘳𝘪𝘯𝘤𝘪𝘱𝘭𝘦 .
3. Data repetition – multiple microservices owning same data – is generally a bad practice and should be avoided.
And don’t forget to apply principles pragmatically!