Why does Ruby favor mixins over multiple inheritance, and how do modules enable this?

Last updated 27 June 2026

  • Ruby uses single inheritance to avoid multiple inheritance's ambiguity (the "diamond problem") and keep one clear resolution path.

  • Modules share behavior via include (inserted into the ancestor chain), prepend (inserted before the class), and extend (class/object-level methods).

  • The linear ancestors order always decides which method wins, enabling composition (e.g. Enumerable) over rigid hierarchies.

  • https://www.cleansystemsconsulting.com/blog/ruby-modules-and-mixins-composition-over-inheritance-in-practice
  • https://betterstack.com/community/guides/scaling-ruby/modules-mixins/
  • https://robertrodes.com/2023/01/25/object-oriented-ruby-inheritance-and-why-ruby-doesnt-allow-multiple-inheritance/
  • https://medium.com/@primedruk312/mixins-in-ruby-09e58b226e50
  • https://medium.com/@ganeshsadudiya/understanding-mixins-in-ruby-include-extend-and-prepend-explained-simply-8e18e74cecdf
All Ruby interview questions