I have a class called ReplaceRule
this is used by 2 classes DocumentRuleViewModel
and SectionRuleViewModel
as a List<ReplaceRule>
in both
Question 1:
In my database
implementation I have 2 distinct tables
for each of the representations. Would it be more standard or efficient to have just 1 with a type column or is 2 perfectly acceptable despite similar structure?
Question 2:
Should I go about making ReplaceRule
an abstract class
and making a DocumentRule
and SectionRule
model that inherits the ReplaceRule
despite them being 100% identical and no perceived changes for the future?
I know in the time I took to write this question could have probably done all of this 3 times over but I'm curious on the decision making process of a more professional approach concerning Time vs implementing full Separation of Concerns
Edit-
The basis for these 2 objects is that we have a document
which you can do a regex search and replace on. Then we have individual sections
which you may do more specific search and replaces on. All of this is automated to run when the document is imported. So the functionality should always mirror each other.
Edit Edit - To extend on the summary: Each document has their own tables Each Section has their own tables that link to a document with a unique ID for each section in the table
The Replace tables stores the ID of the target it wants to look at.
Currently there are 2 tables as to maintain foreign key integrity and 2 classes to query each individually.
The change I would be looking to make would be to have a document ID and Section ID column in 1 table with a type column that says which to use.
For the model it would be set with a type param that would be required in the constructor in order to query the correct setting
Hope this clarifies things