The appropriate class structure to hold this?
Posted on 2014-09-07
I have a KPI which consists of a set of measures which are scored in different ways but each of which use some of the same data to determine a score.
So far I have a VB .net class:
public property DateStart as datetime
public property DateEnd as datetime
public property CVSent as cPerformance
public property SalesLeadsGenerated as cPerformance
public property Interviews as cInterest
public property ClientCalls as cInterest
cPerformance and CInterest inherit from another class cScore. Each of these has a score property which includes its own particular way of determining a score but common to both, they need DateStart/DateEnd from the creating class order to calculate the score.
This suggests to me that either these classes need a reference to their creator or the values passing as constructors.
I wanted it so that when we 'Get' the score it calculates and that makes me think its not really a constructor I want to use since the datestart and dateend may be altered after construction which will affect the score.
So there for I am leaning towards passing a reference to the parent class but from what I understand this is bad practice and there is probably right way to do it...
Can anybody suggest what I should be doing or confirm if this is the right approach?