Adapters and wrappers at your service
Ruby on Rails is a universal web framework, and the usage of adapters and plugins could be easily justified. But do we need the same level of flexibility and extensibility in applications built with Rails? The answer is, as always, it depends. So let me share some particular use cases when using separation patterns is especially helpful.
Modern applications are not isolated pieces of software. Usually, we rely on dozens of third-party services to outsource some functionality. For example, we send emails and other notifications, perform data analysis, collect analytics, and so on. In most cases, there are a variety of third-party providers to choose from.
We can start injecting the provider directly into our application code without using any pattern. Let’s consider, for example, adding a URL-shortening feature.
Assuming we chose bit.ly and the corresponding gem (https://github.com/philnash/bitly) as the implementation, we might...