I'm doing a demo application and I need some guidance to find the best practice. So I planned to have 2 tables, with the following columns:
Table A:
name
quantity
length
color
Table B:
name
quantity
length
type
ingretients
I want to build a model structure which extract the common fields into an abstract class. So I planned the following classes:
Class abstract X
name
quantity
length
Table A extract X:
color
Table B extract X:
type
ingretients
My first question is: Is this a good approach?
Also I planned to design a service which calculates the average lenght of an item (I din't want to use sql queries for this). I was thinking of one service for each class or do one generic service which calculates this value. What do u think, which is the better approach and why?