mercredi 26 février 2020

Java modelling class if objects have same properties but they are fundamentally different

Suppose i have to model credit card report and debit card report. Consider they both have same properties like transaction amount, date of transaction, place of transaction, transaction id and status of transaction.

How should i model this in Java ? Should i create Single class like Creditdebit class having properties as mentioned above and use it for creating credit report as well as debit report? or create separate classes as they are fundamentally different ? how should i handle this kind of scenarios? Help me with resources in dealing such cases or if there is any pattern to handle scenarios like this.

Aucun commentaire:

Enregistrer un commentaire