C++ Design Principles for Ruby - Prefer composition to Inheritance.

J

John Carter

Item 34. Of C++ Coding Standards is "Prefer composition to inheritance".

The objection is inheritance is a very tight coupling between modules.

I would agree with this but expand it in Ruby to...

Prefer composition to inheritance, but if you get the urge to inherit
consider making a mixin instead.





John Carter Phone : (64)(3) 358 6639
Tait Electronics Fax : (64)(3) 359 4632
PO Box 1645 Christchurch Email : (e-mail address removed)
New Zealand

Carter's Clarification of Murphy's Law.

"Things only ever go right so that they may go more spectacularly wrong later."

From this principle, all of life and physics may be deduced.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top