Hacker News new | ask | show | jobs
by nchuhoai 4856 days ago
How would Mutations compare with Concerns, which seems to be DHH's preferred method?
2 comments

One big difference would be encapsulation.

With mixins (sometimes called Concerns), you have a shared state between the module and the class including it.

With a real class, you have your own space and (probably) don't have to deal with state and method collisions.

Pros/cons to each surely, and a lot is a matter of taste at that.

I don't see the correlation here