Question

I attended a meetup yesterday on scaling Rails, and one topic was Hexagonal Rails. However, I've only been doing Rails for a year, and am really comfortable (maybe too comfortable) with the MVC structure, so I don't really understand what adapter and message queue are.

Here's an article about it: http://victorsavkin.com/post/42542190528/hexagonal-architecture-for-rails-developers

And a pic: http://blog.mattwynne.net/wp-content/uploads/2012/06/hexagonal_architecture_sketch.jpg

To my understanding, I think it's about decoupling the parts so that actions are specifically filtered and passed to certain places of your application instead of having a central "router" for everything. I think this results in minimizing the use of ActiveRecord and the creation of a bunch of modules? I am pretty stumped on this so I have a few questions:

  1. To make my project a Hexagonal Rails project, where exactly do I put these modules (what folder? Do I create a new folder of a specific name?)

  2. Is this more for internal maintenance? For security?

From what I know, if a rails app gets too large can't you just split certain parts into another app (I believe it's called service oriented architecture?) and just make requests to it from your main app? Or perhaps use a load balancer + multiple servers if traffic gets too heavy.

Was it helpful?

Solution

The Victor Savkin post you linked to put it well:

The hexagonal architecture helps separate the application from the delivery mechanism.

My understanding is that Hexagonal Architecture has its roots in the view of Rails as just a "delivery mechanism" (possibly one of many) for your actual application. It is an attempt to isolate your app from Rails and goes way beyond what people are trying to do when they are just splitting an app into smaller pieces with engines.

DHH (the creator of Rails) views the Hex architecture as "TDD induced design damage" and there has been a series of talks with the creator of TDD (Kent Beck) and Martin Fowler which you should definitely watch.

My answer to your question would be: don't. The conversation about Hexagonal Architecture is happening right now. Unless you have some burning need to separate your application code from Rails, I suggest you watch the talks and wait until the dust settles to see what comes out of all this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top