Single Table Inheritance VS Polymorphic Associations

I am trying to evaluate the reuse of software between versions.

With out going into how I’m doing this i have a style question:

If I have model Artifact, which right now can be typed as SrcCode or
Document
and basically is a file on the system right now I’m doing this by
polymorphic associations
which works well for the Artifact class

I need to create ReusedArtifact(s) which is a composite of two
artifacts,
and illustrates the differences between the two artifacts. The
problem
is in order to use polymorphic associations I need to save the base
object (ReusedArtifact) before I can create and use it’s sub class
(ReusedSourceCodeArtifact or ReusedDocumentation) methods…

We have these fields for the two types:
DOC: (words)
wdiff_added
wdiff_common
wdiff_changed
wdiff_delete
SRC: (lines)
diff_added
diff_common
diff_changed
diff_delete

Personally I think that a single table inheritance setup, with
added,common,changed and deleted as the fields
would work well. On the other hand can anyone forsee a design problem
that could be caused by counting
and storing two different things (words and lines) in the same
fields…

Thanks
JEsse

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs