Fork me on GitHub

Data Model

So I did some research on how to implement my back end. I have decided to use the Data Access Object pattern to implement the model.

Here is my Entity-Relationship Diagram
gif_1.gif
I will implement a DAO for many of these models. And some DAO’s may access more than one ER.

For example I implemented the DAO for the EPLPlayer as follows

The type of player manager can be read from a properties file (name is of type String). To develop the front end I created SimplePlayerManager which implements the interface PlayerManagerIF

This SimplePlayerManager just hard codes some basic setup so that I can concentrate on developing the Controller and View. I will eventually implement a JDBCPlayerManager that will access a MySql database.

This pattern decouples the model from the view and even the controlled. In the controller I can specify which DAO type I want to use. Everything else stays the same. As well as helping me implement a SimplePlayerManager for prototyping it also provides maintainability to the application. If we needed to change the model to a file or a different database then that would be possible without having to change a lot of code. All we would need to do is implement a new DAO (e.g. XMLFilePlayerManager) and then change the properties file. There will be no code change for the rest of the project.

Tags: erd, db

blog comments powered by Disqus