jeudi 7 mai 2015

design issue when too many derived classes are needed

I am trying to build a badge system that is similar to StackOverflow in my entity-framework code-first application.

I will have around 10 badges in total and each type of badge has its own properties. I am thinking to have base class Badge and derive the other classes from the base class.

For example, there will be Sprinkle badge and it will be automatically assigned to the user if his post is liked 3 times or more. So, I will have Sprinkle class with additional property NumberOfLikes (so that it can be updated later). However, in the database table, there will be only one record for this class. Isn't this weird?

I will have 10 classes like this, and there will be only single record for their corresponding table in the database. I have to have separate classes for each to be able to configure their unique properties.

Is my design choice a poor one?

Aucun commentaire:

Enregistrer un commentaire