0
Answer

Need suggestion about class designing

Ask a question
Hi,

We are developing one windows application which stores different claims related to amount and from that we want to design classes

To enter claims we are using following fields

1)SchemeType
2)ClaimCode
3)ClaimTypes
4)AdditionalPaymentCount
5)SplitPaymentCount
6)ReclaimCount


There are different scheme types say - A, B, C (There is no relation between these schemes)

There are claim types say - C1, C2, C3 (There is no relation between these claim types)

AdditionalPaymentCount means pay additonal amount on main claim. So if user enters first claim then AdditionalPaymentCount will be 0 and if it pays additional amount then new claim will be created from main claim and for this new claim we are setting AdditionalPaymentCount=1 .

SplitPaymentCount means we can split main claim. So the claim amount can be divided i.e. if we want to divide main cliam in 2 parts then in the database there will be main claim record and 2 separate claim having  SplitPaymentCount=1 and SplitPaymentCount=2.

ReclaimCount means if user wants to reclaim then from main claim we are creating new claim i.e. if user reclaims 2 times then in the database there will be main record having ReclaimCount=0 and two newly created record from main claim having ReclaimCount=1 and ReclaimCount=2.

So when user wants to enter claim he will select SchemeType, enter ClaimCode, select ClaimTypes, select AdditionalPayment/SplitPayment/Reclaim option.

In this case every scheme has mentioned ClaimTypes i.e. Scheme A will contain claim types C1, C2, C3 and Scheme B will contain claim types C1, C2, C3 and so on...

In future there is possibility that different schemes and claim types will be added and additonal payment/SplitPayment/Reclaim payment  criteria will be different for each scheme. Also new scheme may contain only claim types C1 and C2 only.

So if we want to design class for this then we are using following method

1)Create base class ClaimTypes
2)Create child class from base class ClaimTypes having combination of Scheme and claim types

Class ClaimTypes
{
  string _ClaimCode;
  protected void SetAdditionalPayment()
  {
  }
  protected void SetSplitPayment()
  {
  }
  protected void SetReclaimPayment()
  {
  }
 
}
Class SchemeACalimTypeC1:ClaimTypes
{
  //use base class methods or redefine it here
}
Class SchemeACalimTypeC2:ClaimTypes
{
  //use base class methods or redefine it here
}
Class SchemeBCalimTypeC1:ClaimTypes
{
  //use base class methods or redefine it here
}
Class SchemeBCalimTypeC2:ClaimTypes
{
  //use base class methods or redefine it here
}

So when user will select SchemeA and Claim Type C2 to enter claim then we will create object of SchemeACalimTypeC2.

The way we are creating child classes with combination of SchemeType and ClaimType is correct or we can create these classes in different way ?

Please give suggestions on this.

Thanks and Regards
Prasad