vendredi 6 février 2015

Extensible Data Access Layer Design Pattern

I have an application where users can play games. There are many games each user can play which need to store data such as score, achievements and upgrades. The way I have done this within the application is to have a Player class which contains things such as username and email and is extended by a more specific class for each game such as a ChessPlayer or a MonopolyPlayer. I am using MongoDB as a database and I have a collection for players and separate collections for players of each game.


I am looking for a data access layer design pattern which will allow me to create specific player objects without duplicating functionality such as getting usernames and email addresses which will be needed for all player objects. I would like the design pattern to be some kind of abstraction from the database even though it is highly unlikely to be changed. Are there any design patterns that would facilitate this?


Aucun commentaire:

Enregistrer un commentaire