The World is a Service

Let's learn about the usage of the adapter.

Hexagonal architecture

Once we get used to the idea of having adapters mediate access between our application and external services, it’s not that far a leap to have adapters internally to mediate between different parts of our application. This approach is sometimes called hexagonal architecture, and many resources can be found online that describe hexagonal architecture as it applies to Rails. Simultaneously, we can find many resources online saying that hexagonal architecture is an awful idea. (David Heinemeier Hansson is a particularly vocal critic).

Action objects usage

We’ve taken baby steps in this direction by creating action objects such as CreatesProject, which are somewhat like adapters between the controller and the model. Many web frameworks use adapters between model objects and the database. Rails do not, but the pattern is not uncommon.

Get hands-on with 1200+ tech skills courses.