Link Details

Link 115021 thumbnail
User 241337 avatar

By moorage
via matthewpaulmoore.com
Published: Sep 17 2008 / 20:13

Practices your development team needs to adhere by
  • 16
  • 0
  • 2082
  • 461

Comments

Add your comment
User 335891 avatar

onno.solin.eu replied ago:

0 votes Vote down Vote up Reply

"If you use STI, you will forever bind the two+ models together in ways that can be very hard to undo - a data migration is never fun."

I don't see what's wrong with building a class hierarchy using Single Table Inheritance. Sure the two+ models will be bound together: that's exactly the point, isn't it? The proposed alternative, using modules, is meant to cover another aspect of domain modeling altogether.

Either you talk about why inheritance is "wrong" (as opposed to using modules -- and they both have their use), or you talk about why STI is a bad implementation of inheritance. Simply stating that STI is a metric of "bad" code is outrageous.

Onno
,
,

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.