Remove Circular Dependencies by Using Dependency Injection and the Repository Pattern in Ruby

2021-03-19来源 Shopify EngineeringEnglish
There are dependencies between gems and the platforms that use them. In scenarios where the platforms have the data and the gem has the knowledge, there is a direct circular dependency between the two and both need to talk to each other. I’ll show you how we used the Repository pattern in Ruby to remove that circular dependency and help us make gems thin and stateless. Plus, I’ll show you how using Sorbet in the implementation made our code typed and cleaner.

原文:https://www.a8q9.cn/en/article/remove-circular-dependencies-by-using-dependency-injection-and-the-repository-pa-4828b6.html

相关文章